find a value and their related values in other columns
4 ビュー (過去 30 日間)
古いコメントを表示
SADRA SADEGHINEJAD
2020 年 4 月 6 日
コメント済み: SADRA SADEGHINEJAD
2020 年 4 月 6 日
Hi, i have a matrix included some rows and columns and I want to find some certain values in the first columns then make a new matrix with them. I have tried with different ways but i couln`t reach to the solution.
example : let`s we have a matrix like this
degree cl
-3 0.01
0 0.04
+3 0.06
6 0.08
9 0.09
now I wanna find where the degree is +3 and 6 and then find their related value of Cl for them
0 件のコメント
採用された回答
KALYAN ACHARJYA
2020 年 4 月 6 日
編集済み: KALYAN ACHARJYA
2020 年 4 月 6 日
Let's example
mat=[-3 0.01
0 0.04
+3 0.06
6 0.08
9 0.09];
data_cl=mat(find(mat(:,1)==3 | mat(:,1)==6),2)
3 件のコメント
KALYAN ACHARJYA
2020 年 4 月 6 日
編集済み: KALYAN ACHARJYA
2020 年 4 月 6 日
Sure, use the any required logical indexing, to met the required condition, as you mentioned in the question
find(mat(:,1)==3 | mat(:,1)==6)
Gives the row index of the particular values, then you can ge the cl of respectice data in 2nd column
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!