Add image on pcshow plot

2 ビュー (過去 30 日間)
Veronica Taurino
Veronica Taurino 2021 年 3 月 16 日
編集済み: Veronica Taurino 2021 年 3 月 19 日
Is it possibile to add an image on a pcshow image (tab of images, in my case)? I'm using this but it does not work:
I need to create a static ''info'' button, where the user can click to read some stuff (image below).
Thank you in advance.

採用された回答

Asvin Kumar
Asvin Kumar 2021 年 3 月 19 日
編集済み: Asvin Kumar 2021 年 3 月 19 日
Here's a simple example that meets your requirements halfway. You can adapt it as necessary.
This example uses uicontrol to add a push button and questdlg for the callback on the push button. The dialog box has to be closed before the user can interact with the plot again.
If you're interested in learning more about dialog boxes, check out the Dialog Boxes and Notifications section. You could use modal message boxes instead of a question dialog box too. Have a look at the linked example.
See this link to learn more about uicontrol properties and customization. You might be interested in the CData property of a uicontrol object to set an icon.
numFaces = 600;
[x,y,z] = sphere(numFaces);
figure;
ax = pcshow([x(:),y(:),z(:)]);
title('Sphere with Default Color Map');
xlabel('X');
ylabel('Y');
zlabel('Z');
f=ax.Parent;
c = uicontrol(f);
c.Style='pushbutton';
c.String = 'Info';
% c.Units='Normalized';
c.Position = [10 400 50 15];
c.Callback = @displayInfo;
function displayInfo(src,event)
answer = questdlg('Put all the information over here!', ...
'Info', ...
'Ok','Ok');
end
  1 件のコメント
Veronica Taurino
Veronica Taurino 2021 年 3 月 19 日
編集済み: Veronica Taurino 2021 年 3 月 19 日
Thank you! It works perfectly fine!

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

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by