MATLAB: Hello, i have problem using imread. i want to process 4 images in 4 different axes. but it says error using imread. here is the codes.

imreadmatlab gui

function buttondeteksi_Callback(hObject, eventdata, handles)
s = get(handles.edit1, 'String');
file = char(s);
[pathstr,name,ext] = fileparts(file);
img_path=[pathstr,name,ext];
addpath(img_path);
image1=imread(file,['\','1.bmp']);
[ci, cp, out] = thresh(image1,100,400);
axes(handles.axes1);
imshow(out);
setappdata(handles.edit1,'localImg',image1);
setappdata(handles.edit1,'IrisParam',ci);
setappdata(handles.edit1,'PupilParam',cp);
image2=imread(file, ['\','2.bmp']);
[ci, cp, out] = thresh(image2,100,400);
axes(handles.axes2);
imshow(out);
setappdata(handles.edit1,'localImg',image2);
setappdata(handles.edit1,'IrisParam',ci);
setappdata(handles.edit1,'PupilParam',cp);
image3=imread(file, ['\','3.bmp']);
[ci, cp, out] = thresh(image3,100,400);
axes(handles.axes3);
imshow(out);
setappdata(handles.edit1,'localImg',image3);
setappdata(handles.edit1,'IrisParam',ci);
setappdata(handles.edit1,'PupilParam',cp);
image4=imread(file, ['\','4.bmp']);
[ci, cp, out] = thresh(image4,100,400);
axes(handles.axes4);
imshow(out);
setappdata(handles.edit1,'localImg',image4);
setappdata(handles.edit1,'IrisParam',ci);
setappdata(handles.edit1,'PupilParam',cp);
set(handles.buttonnormal,'Enable','on');

Best Answer

Due to a lack of documentation about the expected inputs and outputs, I had to make some guesses as to how the routine should work.
function buttondeteksi_Callback(hObject, eventdata, handles)
s = get(handles.edit1, 'String');
file = char(s);
[pathstr,name,ext] = fileparts(file);
img_path = pathstr;
image1 = imread( fullfile(pathstr, '1.bmp') );
[ci, cp, out] = thresh(image1,100,400);
axes(handles.axes1);
imshow(out);
setappdata(handles.axes1,'localImg',image1);
setappdata(handles.axes1,'IrisParam',ci);
setappdata(handles.axes1,'PupilParam',cp);
image2 = imread( fullfile(pathstr, '2.bmp') );
[ci, cp, out] = thresh(image2,100,400);
axes(handles.axes2);
imshow(out);
setappdata(handles.axes2,'localImg',image2);
setappdata(handles.axes2,'IrisParam',ci);
setappdata(handles.axes2,'PupilParam',cp);
image3 = imread( fullfile(pathstr, '3.bmp'));
[ci, cp, out] = thresh(image3,100,400);
axes(handles.axes3);
imshow(out);
setappdata(handles.axes3,'localImg',image3);
setappdata(handles.axes3,'IrisParam',ci);
setappdata(handles.axs3,'PupilParam',cp);
image4 = imread( fillefile( pathstr, '4.bmp') );
[ci, cp, out] = thresh(image4,100,400);
axes(handles.axes4);
imshow(out);
setappdata(handles.axes4,'localImg',image4);
setappdata(handles.axes4,'IrisParam',ci);
setappdata(handles.axes4,'PupilParam',cp);
set(handles.buttonnormal,'Enable','on');
Related Question