フィルターのクリア

how to invisible plot in gui which contains hold on?

5 ビュー (過去 30 日間)
alireza kooshafar
alireza kooshafar 2018 年 12 月 14 日
コメント済み: alireza kooshafar 2018 年 12 月 14 日
I have a plot which is in for loop with hold on like this:
for i=1:size(V)
handles.p2=plot(........)
hold on
end
i want to let the user visible or invisible it by toggle button like this:
h = get(handles.t1,'Value');
if h==1
set(handles.p2,'visible','on')
else
set(handles.p2,'visible','off')
end
guidata(hObject, handles)
the problem is that it works just for the last itteration of for loop not for the hole plot
tnx for help

採用された回答

Cris LaPierre
Cris LaPierre 2018 年 12 月 14 日
編集済み: Cris LaPierre 2018 年 12 月 14 日
Do you want to hide the lines or the entire axes?
The problem is you are overwriting the handle to the previous plot each loop. If you want to capture them all, you need to create a vector of handles.
for i=1:size(V)
handles.p2(i)=plot(........)
hold on
end
The, to set them all off in one command, you can use
set(handles.p2,'Visible','off')

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by