Effacer les filtres
Effacer les filtres

Plot handle to return single object

2 vues (au cours des 30 derniers jours)
Markos Sigalas
Markos Sigalas le 15 Nov 2019
Commenté : Markos Sigalas le 16 Nov 2019
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

Réponse acceptée

Praveen Iyyappan Valsala
Praveen Iyyappan Valsala le 15 Nov 2019
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 commentaires
Praveen Iyyappan Valsala
Praveen Iyyappan Valsala le 16 Nov 2019
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 le 16 Nov 2019
You're so right.
Thank you very much.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Plot Customization dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by