Calling a specific value from a matrix using a loop
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone,
I have a set of matrix, called att_power:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1218907/image.png)
I need to use a for loop to call some of the values in the first column of the matrix, such as I could be calling 5, 15, 30, and 50 only.
Based on the values, I am calling, I need matlab to create matrix showing the corresponding values in the second column.
In this case, I want to matlab to create a matrixx, showing [4.2, 32, 115, 273]
Can anyone please help me on this?
Kind regards,
Nilesh
0 件のコメント
採用された回答
Voss
2022 年 12 月 4 日
vals = [5 15 30 50];
idx = ismember(att_power(:,1),vals);
result = att_power(idx,2)
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!