How to change image of axes within a programmatic function?

1 visualización (últimos 30 días)
Tamfor Dulin
Tamfor Dulin el 21 de Ag. de 2015
Comentada: Tamfor Dulin el 22 de Ag. de 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

Respuestas (1)

Walter Roberson
Walter Roberson el 21 de Ag. de 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 comentario
Tamfor Dulin
Tamfor Dulin el 22 de Ag. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by