Plot handle to return single object

2 次查看(过去 30 天)
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
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
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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by