How to divide the data of a matrix?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a data in which the first column gives the time and the second column gives the velocity. The time varies from 0 to 0.8 seconds.I want to divide the time into groups starting from 0 to 0.1 s, 0.1 to 0.2 ..., 0.7 to 0.8 s.Then take the count of the velocity in the respective group.
2 件のコメント
Azzi Abdelmalek
2014 年 2 月 13 日
Then take the count of the velocity in the respective group What does that mean?
回答 (1 件)
Jos (10584)
2014 年 2 月 13 日
TIMES = DATA(:,1) ;
VELS = DATA(:,2) ;
TakeTheCountOfTheVelocityFunction = @(V) numel(V) ; % or whatever you mean by this?
[n, GroupIDX] = histc(TIMES,0:0.1:0.8) ; % GroupIDX specifies the group
Result = accummarray(GroupIDX(:), VEL(:), TakeTheCountOfTheVelocityFunction)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!