calculate mean and max values using the groupsummary command
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
As you can see from the attached picture I have successfully imported a large table matrix (T2) that shows certain wave motion variables for several years (hourly). I am trying to study the mean and maximum yearly values using "groupsummary" ( more or less like this: T22 = groupsummary(T2,"Var1","year",'mean'); ) but the command doesn't work and I am pretty sure it is because the 3rd and 6th columns have values between apostrophes ( 'x' ). I have run the same command in other situations and it works perfectly fine so I guess that the solution would be to get rid of those apostrophes..
Is there a smart way to do that? Of course I cannot do it manually since the matrix is extremely large.
Thank you in advance for your help and patience.
6 Commenti
Simon Chan
il 7 Set 2022
Seems your data can be retrieved by using readtable without any issues. Below shows the data from your attached csv file on year 2004.
On the other hand, since your data are already separated on a yearly basis. There is no need to use function groupsummary to determine the mean and maximum values for each year. You can just use function mean or max directly.
data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1117965/Wave%20Data%202004_Open%20Data_WLC.csv','VariableNamingRule','preserve');
head(data,5)
Risposte (1)
Seth Furman
il 12 Set 2022
tt = readtimetable("https://in.mathworks.com/matlabcentral/answers/uploaded_files/1117915/Wave%20Data%201994_Open%20Data_WLC.csv","VariableNamingRule","preserve")
retime(tt(:,vartype("numeric")),"yearly","mean")
retime(tt(:,vartype("numeric")),"yearly","max")
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices 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!