How to change image of axes within a programmatic function?

1 Ansicht (letzte 30 Tage)
Tamfor Dulin
Tamfor Dulin am 21 Aug. 2015
Kommentiert: Tamfor Dulin am 22 Aug. 2015
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

Antworten (1)

Walter Roberson
Walter Roberson am 21 Aug. 2015
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 Kommentar
Tamfor Dulin
Tamfor Dulin am 22 Aug. 2015
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by