I try reduce my matrix a single value for my input or a call a value
1 次查看(过去 30 天)
显示 更早的评论
Hello. I have matrix and I try the use the value in the matix for my input. I wanna the take this value as a integer. Also all values are integer in my matix. How can I take a value for my input in matrix. Thanks a lot.
1 个评论
David Hill
2022-11-29
Just index into your matrix. You can use linear indexing or row,column
m=randi(100,10)
m(15)
m(5,2)
回答(1 个)
Vilém Frynta
2022-11-29
You can call value in vector by specifying it's position.
mtx = [1, 2; 3, 4; 5, 6]
Now you have to write matrix name (in my example it's "mtx") and write position. First row number, then column number.
mtx(1,2) % number in 1st row, 2nd column
mtx(3,1) % number in 3rd row, 1st column
Is this what you asked? Feel free to ask more. I'm not 100% sure I understood your question.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!