GUI push button - create multiple plots

Dear all,
I am new to GUI-programming and my question is rather simple I hope. I am creating some plots using a push button. For the simple example-code below it works perfectly fine:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) axes(handles.axes1); cla;
vars = evalin('base','gui_A');
popup_sel_index = get(handles.popupmenu1, 'Value'); switch popup_sel_index
case 1
plot(vars(:,:,1)');
case 2
plot(vars(:,:,2)');
case 3
plot(vars(:,:,3)');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
What do I have to modify if I want to create a larger number of plots? I had the idea to write a loop like this:
for i=1:3
case i=plot(vars(:,:,i)')
end
However, it does not seem to work like this, please help!

3 件のコメント

kanimbla
kanimbla 2014 年 8 月 31 日
Obviously, I tried:
for i=1:3
case i
plot(vars(:,:,i)')
end
Jos
Jos 2014 年 8 月 31 日
did you include 'switch i' between 'for i=1:3' and 'case i'?
kanimbla
kanimbla 2014 年 9 月 1 日
Many thanks!
Best regards

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

質問済み:

2014 年 8 月 31 日

コメント済み:

2014 年 9 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by