App Designer: How to add components that are not listed in the library

3 ビュー (過去 30 日間)
Kurt
Kurt 2023 年 3 月 22 日
コメント済み: Kurt 2023 年 3 月 23 日
The App Designer Component Library contains a limited number of components to drag and drop. There are many more components and functions available in Matlab, but I can't find documentation on how to incorporate them into the classes and methods environment (like App Designer). Some of these include:
sphere;
surf;
cameratoolbar;
plot3;
rotate;
There are non-object oriented examples for many of these, but incorporating them into methods is a challenge for me. And it would appear that folding them into App Designer is impossible, unless I pull the code out and put it in an independent script to work on. Suggestions?
For example, how do I even define the Properties for a sphere object when I don't even know the path to it? (matlab.ui....?)

採用された回答

Cameron
Cameron 2023 年 3 月 22 日
For these, you need to specify the axis. For example, if you have a UIAxes component, you would do this:
%for a sphere
sphere(app.UIAxes,10)
%for surf
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
surf(app.UIAxes,X,Y,Z)
%for plot3
t = 0:pi/50:10*pi;
st = sin(t);
ct = cos(t);
plot3(app.UIAxes,st,ct,t)
  5 件のコメント
Adam Danz
Adam Danz 2023 年 3 月 23 日
You have to tell the axes to hold its current state
surf(__)
hold(app.UIAxes,'on')
plot3(__)
Kurt
Kurt 2023 年 3 月 23 日
Thanks. That works!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEarth and Planetary Science についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by