
GUIDE で作成した GUI 内にsubplot を作成することはできますか?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 19 Apr. 2018
Beantwortet: MathWorks Support Team
am 19 Apr. 2018
GUIDE を使用して作成した GUI があります。この GUI の中で、axes の中に subplot 関数を使用して複数の軸を作成したいと考えています。
どのように作成すればよいでしょうか。
Akzeptierte Antwort
MathWorks Support Team
am 19 Apr. 2018
subplot は axes の一種であり、Figure の下に作成することはできますが、axes の下に作成することはできません。
また、GUIDE で作成した GUI には Figure が含まれていないため、Figure の下に紐づけて作成することができません。
回避策として、パネル uipanel を作成し、その下に複数の軸を紐付ける方法があります。具体的なコードは以下のとおりです。
% uipanel を使用してパネルの作成
panhandle = uipanel('Position', ....);
% 親ハンドルを panhandle として指定し、subplot の軸を作成
pax1 = subplot(2,2,1,'Parent', panhandle);
pax2 = subplot(2,2,2,'Parent', panhandle);
...
handles.panhandle = panhandle;
handles.pax1 = pax1;
handles.pax2 = pax2;
…
% ハンドルデータを保存
guidata(hObject, handles);
添付の guide_ex.m は、実行すると以下のようなGUIが表示されます。エディットテキストボックスに数を入れると、uipanel 内でそれに応じた軸の数を表示する例です。Pushbotton のコールバックに上記のようなコードを含めています。

0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!