Find value from column / row number
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I've vector A = [5, 7, 8, 11, 4, 5, 7]
Now, I want to know what is value in column number 3 and 5, hoping with results 11 and 4.
Can you help me get the script
1 件のコメント
Vijay Mohangekar
2020 年 3 月 19 日
Do you mean >>A(3) and >>A(5) Note: unlike python here indexing starts with 1,2,....
回答 (2 件)
Star Strider
2018 年 3 月 27 日
In MATLAB, array indexing uses integers greater than zero, so indices corresponding to your vector elements 11 and 5 would be 4 and 6, respectively.
0 件のコメント
Bob Thompson
2018 年 3 月 27 日
If all you want to know is the value of a certain part of the matrix just call the index.
A(3)
A(3) = 8
You can call multiple things with indexing, and you can add logic statements to check for certain values as well if you would like.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!