Plot handle to return single object

3 ビュー (過去 30 日間)
Markos Sigalas
Markos Sigalas 2019 年 11 月 15 日
コメント済み: Markos Sigalas 2019 年 11 月 16 日
Hi,
i'm building a GUI where I'm supposed to turn on or off the Visibility of multiple plots.
So far, what i'm doing is to get the handle of the plot and then toggle the Visibility property.
hraw=plot(cur_axes,time(1:test_plot_range),raw_signal(1:test_plot_range),linetype);
hraw.Visible='on';
For the majority of the plots, i get a handle [1×1 Line].
However, there are cases where the returned handle consists of all the line points [1041×1 Line].
hraw_mean=plot(cur_axes,cur_struct.time(1:test_plot_range),raw_mean*ones(test_plot_range),'m-','MarkerSize',cell2mat(signal_struct.params(4)));
Please note that "hraw_mean" refers to a straight line, where the "hraw" handler refers to random signals (not straight lines).
A workaround would be to loop through all points and toggle their visibility ( indexing with : -e.g. hraw_mean(:) raises an error), but I'd prefer a more elegant way (i.e. return a single sized handler).
Are there any suggestions?
Thank you in advance
Markos

採用された回答

Praveen Iyyappan Valsala
Praveen Iyyappan Valsala 2019 年 11 月 15 日
You can use set function.
hraw_mean.set('Visible','off');
That sets Visible proptery of all cells to off. If you want to set a property for some cells only.
hraw_mean([1:3 7 8]).set('Visible','off');
  3 件のコメント
Praveen Iyyappan Valsala
Praveen Iyyappan Valsala 2019 年 11 月 16 日
It is because of your input data. ones(size) gives you sqare matrix of dimension size X size
raw_mean*ones(test_plot_range)
Generate 1D array instead
raw_mean*ones(1,test_plot_range)
Markos Sigalas
Markos Sigalas 2019 年 11 月 16 日
You're so right.
Thank you very much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePlot Customization についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by