Sorting data from table
Mostrar comentarios más antiguos
Hi, I have a table T (8766x4) columns are - month, day, year and Flow rate (that is 24 years of data - 8766 days). I need to sort flow rate for each year separately and descend flow rate for each year and then plot.
P.S. I am afraid this approach with tables is wrong
Respuesta aceptada
Más respuestas (1)
Guillaume
el 15 de Oct. de 2018
Simple:
sortedtable = sortrows(yourtable, 'year', 'flowrate', {'ascend', 'descend'}) %sort ascending by year, and for identical year, descending by flow rate
where 'year' and 'flowrate' are the variable names of your year and flow rate column respectively.
A table is the right approach.
2 comentarios
Jiri Soucek
el 15 de Oct. de 2018
Peter Perkins
el 17 de Oct. de 2018
I think something like Guillaume's is the right way to go: sort the data by time, then make a plot for each year. From the plot you made, it seems like your original description is not accurate -- it looks to me like you want to plot flow rate by time, overlaying each year.
So: sortrows using year/month/day, then use varfun to make the plots (with hold on/of before and after).
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
