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

조회 수: 4 (최근 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 CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by