1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
[filename,pathname] = uigetfile({'*.jpg';'*.png';'*.bmp'}); %selecting the file with an open dialog
if ~ischar(filename) %on cancel press function ischar returns 0
errordlg('Error!','No file selected!'); %appears an error dialog on cancel press
return;
end
img = imread(fullfile(pathname,filename)); % reading the file stored in path
imshow(img);
imshow(img,'parent',handles.axes1); %displays image selected in component axes1
%[filename,pathname] =uigetfile('*.jpg');
%img=imread(fullfile(pathname,filename),'jpg');
%
%R='C:\MATLAB71\work';
%the code that isn't working storing in static text the path of every file
%loaded in axes1 on pushbutton1 press named Load image
str = get(handles.text1,'string');
str = cellstr(str);
str{end+1} = fullfile(pathname,filename);
set(handles.text1,'string',str); %storing in listbox the path of every image loaded in axes1
load(fullfile(pname,fname),'C:\MATLAB71\work');
set(handles.text1,'String','C:\MATLAB71\work'); |
Partager