I try reduce my matrix a single value for my input or a call a value
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
David Hill
el 29 de Nov. de 2022
Just index into your matrix. You can use linear indexing or row,column
m=randi(100,10)
m(15)
m(5,2)
Respuestas (1)
Vilém Frynta
el 29 de Nov. de 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 comentarios
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!