Want to draw two axes using a single popupmenu
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ahasan ratul
am 7 Apr. 2018
Beantwortet: Munish Verma
am 12 Dez. 2021
I haven't used matlab gui before. I want to draw two plots using a popup menu. Suppose, I want to plot cm and mm values in two axes Using a popup menu which has multiple object names. So each time I select one option from popup menu it shows both cm and mm values in two different axes. Any help with an example is highly appreciated.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 7 Apr. 2018
function popup1_Callback(hObject, event, handles)
all_strings = get(hObject, 'String');
if ischar(all_strings); all_strings = cellstr(all_strings); end
which_chosen = get(hObject, 'value');
chosen_string = all_strings{which_chosen};
ax1 = handles.axes1;
ax2 = handles.axes2;
switch chosen_string
case 'lollipop':
plot(ax1, 1:20, rand(1,20));
plot(ax2, 1:20, rand(1,20)*10);
case 'ping-pong':
plot(ax1, 1:20, randn(1:20));
plot(ax2, 1:2), randn(1:20)*10);
end
2 Kommentare
Walter Roberson
am 7 Apr. 2018
plot(ax1, 1:50, randn(1:50));
plot(ax2, 1:50, randn(1:50)*10);
should be
plot(ax1, 1:50, randn(1,50));
plot(ax2, 1:50, randn(1,50)*10);
Weitere Antworten (1)
Munish Verma
am 12 Dez. 2021
plot(ax1, 1:50, randn(1,50));
plot(ax2, 1:50, randn(1,50)*10);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps 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!