How can I record value once condition is satisfied by searching a matrix?

1 回表示 (過去 30 日間)
Nadia Numa
Nadia Numa 2020 年 8 月 3 日
コメント済み: Nadia Numa 2020 年 8 月 19 日
Hello!
I have a 2234x42 matrix. I would like to search the 2nd column of the matrix for every time a condition is met. Say for a value less than or equal to some tolerance. I also would like to record values in the 4th and 5th column at that condition as well. Does anyone have some insights on how to approach this?
I tried to do something like:
for k = 1:size(state,1)
S = cell(find(state(k,2)<= 1E-4));
end
However, I do not need the position, I need to grab the actual value. Thanks in advance!
Thanks!

採用された回答

David Hill
David Hill 2020 年 8 月 3 日
newMatrix=yourMatrix(yourMatrix(:,2)<=tol,4:5);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by