I try reduce my matrix a single value for my input or a call a value
1 view (last 30 days)
Show older comments
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 Comment
David Hill
on 29 Nov 2022
Just index into your matrix. You can use linear indexing or row,column
m=randi(100,10)
m(15)
m(5,2)
Answers (1)
Vilém Frynta
on 29 Nov 2022
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 Comments
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!