Is there a function that can make new categorical array by sorting numeric data from a table?

8 ビュー (過去 30 日間)
I am tracking fish location in a tank over time, and want to show graphically a box plot of the fish's x coordinate.
My data goes for a full hour, though, and I need to split that time up into around 10 smaller segments so I can see the average x coordinate of the fish during each time span. I've looked at sort, ordinals, discretize, histcounts, and more and I can't get any of them to do this. They can sort the data into bins by time but don't return the sections in any way that I can then graph. Any ideas what functions I should try?

採用された回答

Peter Perkins
Peter Perkins 2018 年 11 月 27 日
I guess your x coordinate is just numeric values. It seems like putting your raw data into a timetable would be the way to go. Then use retime to compute averages within each time bin, and plot tt.X vs. tt.Time (or whatever you called the variables).
  2 件のコメント
Cichlid Tracker
Cichlid Tracker 2018 年 11 月 29 日
Thanks so much! this is very helpful. Do you know if this sort of function could also be able to retain data within the bins so that max min etc could be found in each one? so that I could make a boxplot with each bin as their own box?
Peter Perkins
Peter Perkins 2018 年 12 月 11 日
Well, you can do anything, and I can think of several ways to retain the raw data for each time bin. But if you want to make boxplots usig the boxplot function in Statistics and Machine Learning Toolbox, then I think you want to keep the original tietable and just add a bin number as a new variable. I think discretize is the best way to do that. Then pass the var you want to make a boxplot of, along with the bin numbers, into boxplot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by