How to transfer a figure to a GUI?
3 ビュー (過去 30 日間)
古いコメントを表示
Dear all,
I want to add a push button to a figure, so I used this code
I = imread('cameraman.tif');
figure, imshow (I);
uicontrol('Style', 'pushbutton', 'String', 'SAVE',...
'Position', [20 20 50 20],...
'Callback', ...
@yourCallback);
Now, how to show this figure in the GUI's axis after pressing the button?
I used the following code before, but now not working in Matlab2015b
uicontrol('Style', 'pushbutton', 'String', 'SAVE',...
'Position', [20 20 50 20],...
'Callback', ...
@yourCallback);
function yourCallback(ObjH, EventData)
I = getimage;
setappdata(0, 'I', I);
resXGui; %the name of the GUI
Is there any alternative way to do that?
Any help will be appreciated.
Meshoo
2 件のコメント
Geoff Hayes
2016 年 2 月 3 日
Meshoo - is that all the code there is to your callback? What does getimage do (isn't a handle to the figure where the image shown needed)? Is resXGui a different GUI that you wish to transfer the image to?
Please show all of your code (for this callback) and comment on what is happening or is supposed to b e happening. You say that I used the following code before, but now not working in Matlab2015b. Please clarify what part of the code is not working. Discuss what you observe and what you wish to observe. If any errors are being generated then copy and paste the full error message to your question.
回答 (1 件)
Stalin Samuel
2016 年 2 月 3 日
I = imread('cameraman.tif');
hb = uicontrol('Style','pushbutton',...
'String','Click here',...
'Callback','imshow(I)');
4 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!