Finding Table Column Mean, Median and Display
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Amritpal Kaur
il 15 Mag 2016
Risposto: Matt Cohen
il 17 Mag 2016
So I have a Matlab table named wow. I want to find the mean, median of the same and display it in my plot. Here is my code till now:
So my table looks like:
Val1 Val2 Val2 Val4
String String float float
String String float float
...
I am line plotting certain specific Val1 and Val2 pairs via.
T1 = wow(strcmp(wow.Val1, 'Some String') & strcmp(wow.Val2, 'Some String'), :) ;
T2 = wow(strcmp(wow.Val1, 'Some String') & strcmp(wow.Val2, 'Some String'), :) ;
...
subplot1(9, 9, 'Gap', [.01 .02], 'XTickL','Margin','YTickL','Margin','FontS',4);
subplot1(1)
plot( T1.Val3, T1.Val4)
subplot1(9, 9, 'Gap', [.01 .02], 'XTickL','Margin','YTickL','Margin','FontS',4);
subplot1(2)
plot( T2.Val3, T2.Val4)
So, I want to show the mean and median of the Val4 column in each of the plots. That is, I just want to draw a line for the mean and median as it would do using the Data Statistics toolbox.

However, when I use the GUI, as soon as I select data2, my lines for data one disappear!

0 Commenti
Risposta accettata
Matt Cohen
il 17 Mag 2016
Hi Amritpal,
I understand that you are interested in why the statistics lines disappear from one subplot when you switch to a different data set in the Data Statistics Tool.
Unfortunately, it is currently not possible to display the statistics information across multiple subplots in the same figure. Only the statistics for the currently selected data set can be displayed. Once you switch to a different data set, the previous data set's statistics lines will disappear from its respective subplot.
One workaround would be to use multiple figures instead of subplots. You get a new Data Statistics Tool per figure. However, this is not exactly an ideal workaround for most situations. Another workaround would be to compute the statistics for each data set and manually plot these statistics values as horizontal lines on the appropriate subplots.
I hope this information helps to answer your specific question.
Matt
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!