フィルターのクリア

How to use the image from first pushbutton in function second pushbutton in gui?

3 ビュー (過去 30 日間)
syafini alias
syafini alias 2018 年 2 月 16 日
コメント済み: syafini alias 2018 年 2 月 16 日
For pushbutton1, i have used to browse the image and preview in axes2. How can i use the same image as i choose from pushbutton1 when i press pushbutton2 to analyse that image?
  2 件のコメント
syafini alias
syafini alias 2018 年 2 月 16 日
Sorry. I don't understand. Can you give me some examples. Sorry for troubling you.
Rik
Rik 2018 年 2 月 16 日
See my edit for some code

サインインしてコメントする。

採用された回答

Rik
Rik 2018 年 2 月 16 日
編集済み: Rik 2018 年 2 月 16 日
Save the path to the image (or the image itself) to the struct in guidata.
The callback function of pushbutton1 should contain a line like this:
handles.pushbutton1_image=IM;
You need to make sure to re-save the struct after that line, so before the function ends, you need to make sure this line is there:
guidata(hObject,handles)
Now you can access the pushbutton1_image field in the pushbutton2 callback function:
if ~isfield(handles,'pushbutton1_image')
return
%exit function if pushbutton1 has not run yet
%you can replace this by a warning if you want to
end
IM=handles.pushbutton1_image;

その他の回答 (0 件)

カテゴリ

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