Showing more than one image in a GUIDE gui

1 回表示 (過去 30 日間)
Douglas Anderson
Douglas Anderson 2020 年 1 月 16 日
コメント済み: Adam Danz 2020 年 1 月 16 日
Hello.
I have a GUIDE gui that worked fine for a while, until I try to put a new image in axes for a logo.
% Plot the background and the logo: Background on axes2, logo on axes3
dir_name = ['C:\Users\',login,'\Desktop'];
wiggle_file_name = [dir_name,'\wiggles3.jpg'];
if exist(wiggle_file_name,'file')
imshow(wiggle_file_name);
end
logo_file_name = [dir_name,'\ctrl_v_logo.jpg'];
% imshow(logo_file_name); % Overwrites axes2
imshow(logo_file_name,handles.axes3); %doesn't work
Any suggestions? I am not sure why the first image goes to axes2, this is at the beginning of the OpeningFcn
Thanks!
Doug Anderson

採用された回答

Geoff Hayes
Geoff Hayes 2020 年 1 月 16 日
Douglas - perhaps try
imshow(logo_file_name, 'Parent', handles.axes3);
where you include the Parent name for the axes value.
  1 件のコメント
Douglas Anderson
Douglas Anderson 2020 年 1 月 16 日
Great! Thank you very much.

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

その他の回答 (1 件)

Adam Danz
Adam Danz 2020 年 1 月 16 日
編集済み: Adam Danz 2020 年 1 月 16 日
Specify the axis when calling imshow (see parent name-value)
imshow(wiggle_file_name, 'Parent', handles.axes2)
"I am not sure why the first image goes to axes2"
I don't know what your code is supposed to do but I just wanted to point out a comment in your code:
"Background on axes2, logo on axes3"
Lastly, use fullfile() when construction paths to files. One problem could be that your file paths aren't constructed properly. See this link for an explanation of why fullfile() is much better than construction paths using simple character concatenation.
  2 件のコメント
Douglas Anderson
Douglas Anderson 2020 年 1 月 16 日
Thank you for the additional suggestions, Adam!
Adam Danz
Adam Danz 2020 年 1 月 16 日
Glad I could help!

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

カテゴリ

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