Not enough input arguments error(line 5).
Mostrar comentarios más antiguos
When I'm writing the following code:
function pushbutton3_Callback(hObject, eventdata, handles)
[filename pathname] = uigetfile({'*.png';'*.ipg'},'File Selector');
image = strcat(pathname, filename);
img1=imread(image);
axes(handles.axes1);
figure, imshow(img1);
h = waitbar(0,'Image is processing, Please wait...');
steps = 1000;
for step = 1:steps
waitbar(step / steps)
end
I1=rgb2gray(img1);
str=strel('disk',10);
test2=imopen(I1,str);
level = graythresh(test2);
bw = im2bw(test2,level);
str=strel('disk',25);
test3=imopen(bw,str);
axes(handles.axes4);
imshow(test3)
%draw borders
B = bwboundaries(test3);
axes(handles.axes4);
imshow(test3)
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'g', 'LineWidth', 0.2)
end
%Print count
[labeled,numObjects] = bwlabel(test3,4);
set(handles.lbl_tot_obj,'string', numObjects);
%Print file name and location
set(handles.edit1,'string',filename);
set(handles.edit2,'string', image);
close(h)
end
The following error pops up:
Not enough input arguments.
Error in color (line 5)
axes(handles.axes1);
I used this image file as input -

I just want to know if there's a problem with the axes or i messed up somewhere along the way. Thank you.
1 comentario
Where has this function come from? It looks like part of a GUIDE file, but the fact the error message points to line 5 suggests it is just a standalone file. Then again it also seems to think the file is called 'color', which cannot be the case if this is the whole file.
It is possible to have a function like this in a standalone file (though doesn't make much sense), but you have to make sure you pass the 3 arguments in that it is expecting if you have detached it from a GUIDE file.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!