Not enough input arguments
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I believe to properly have set up the function. I don't think to miss anything, but still keeps giving me the error of not enough input arguments.
function AxialView(object,eventdata,ImgAx,S_s,S_c,S,S_a,sno,sno_a,Rmin,Rmax,shand,stxthand)
if view == 'S'
S_s = S;
elseif view == 'C'
S_c = S;
end
view == 'A';
Img = ImgAx;
S = S_a;
sno = sno_a;
cla(hdl_im);
hdl_im = axes('position',[0,0.2,1,0.8]);
imshow(squeeze(Img(:,:,S,:)), [Rmin Rmax])
if sno > 1
shand = uicontrol('Style', 'slider','Min',1,'Max',sno,'Value',S,'SliderStep',[1/(sno-1) 10/(sno-1)],'Position', S_Pos,'Callback', {@SliceSlider, Img});
stxthand = uicontrol('Style', 'text','Position', Stxt_Pos,'String',sprintf('Slice# %d / %d',S, sno), 'BackgroundColor', [0.8 0.8 0.8], 'FontSize', SFntSz);
else
stxthand = uicontrol('Style', 'text','Position', Stxt_Pos,'String','2D image', 'BackgroundColor', [0.8 0.8 0.8], 'FontSize', SFntSz);
end
caxis([Rmin Rmax])
if sno > 1
set(stxthand, 'String', sprintf('Slice# %d / %d',S, sno));
else
set(stxthand, 'String', '2D image');
end
set(get(gca,'children'),'cdata',squeeze(Img(:,:,S,:)))
set (gcf, 'ButtonDownFcn', @mouseClick);
set(get(gca,'Children'),'ButtonDownFcn', @mouseClick);
end
5 comentarios
Stephen23
el 12 de Dic. de 2017
Editada: Stephen23
el 12 de Dic. de 2017
@Stelios Fanourakis: at the top you show us how you define the function, but not how it is called. I ask you to please show us how you are calling the function.
Basic ways of calling functions are explained in the introductory tutorials, which are highly recommended for all beginners:
Respuestas (1)
Stephen23
el 12 de Dic. de 2017
Editada: Stephen23
el 12 de Dic. de 2017
Your comment shows that you have provided the function handle as a callback function to some GUI object. When you read the documentation for callback functions, it will inform you that by default only two arguments are provided to the callback function, which are called the source and event (commonly named src and evt inside the function definition).
Your function requires more than two input arguments - do you see the problem now?
If you wish to pass additional arguments then you will have to either:
- Read the section "Passing Additional Input Arguments" in the documentation that I linked to above.
- Use nested functions.
MATLAB does not just magically fill all of those input arguments with values.
0 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!