Finding minimum within a set of rows below a certain point?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matrix X which has a different participant's data (Z) for each row across 10 time points (t) as the columns, I need to find the minimum amount of time and maximum amount of time where Z reaches 2 across the participants.
0 件のコメント
回答 (2 件)
CAM
2023 年 4 月 5 日
I suggest using the find command (with Z>=2) with row & column as outputs. Find the min and max column values and their associated row (subject). Using these row-column pairs, you can get the times.
Duncan Carlsmith
2023 年 4 月 5 日
編集済み: Duncan Carlsmith
2023 年 4 月 5 日
% Make fake data, rows of random monotonically increasing values.
X=cumsum(rand(10),2)
% Make logical array for values satisfying the condition.
Y=X>2;
% Find the transition points
Z=diff(Y,1,2);
% Get the indices of the transition points.
[row,col]=find(Z==1);
%List the times of transitions.
[B,I]=sort(row);
Times=col(I)'
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Particle & Nuclear Physics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!