How to change image of axes within a programmatic function?

1 回表示 (過去 30 日間)
Tamfor Dulin
Tamfor Dulin 2015 年 8 月 21 日
コメント済み: Tamfor Dulin 2015 年 8 月 22 日
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by