How to change image of axes within a programmatic function?

1 次查看(过去 30 天)
I tried changing the image of the axes (created with GUIDE) by using...
axes(handles.intro_chckbx_cmp)
imshow('check.png')
within a programmatically created function but it continues to give errors saying
Not enough input arguments.
Error while evaluating UIControl Callback
please help

回答(1 个)

Walter Roberson
Walter Roberson 2015-8-21
The problem is not those two lines of code.
You put those lines of code into a function, and you defined the function to take some number of parameters (such as 3 or 4), but when the function was called, you did not pass as many parameters as were needed.
I suspect that you defined the function to take 3 parameters, hObject, event, handles, as is usual for GUIDE, but that you did not let GUIDE create the Callback, that you either configured the uicontrol('Callback') yourself or that you used the property editor to edit the Callback of the uicontrol. MATLAB only automatically provides two parameters to callbacks, and does not automatically provide the handles parameter. When you use GUIDE to create the callback, it sets the Callback stored in the .fig to be a string that, when evaluated, finds the handles structure and passes it in to the real routine along with the two default parameters. If you set the Callback yourself or edited the properties of the uicontrol you probably did not set up the routine the same way and the function is probably only being called with two parameters.
  1 个评论
Tamfor Dulin
Tamfor Dulin 2015-8-22
So how would I be able to fix this problem?
I was thinking about using the callback of the axes and add an if statement to change image depending on the value or true/false, but it does not have one.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by