if a variable has the dimension 1 x 1 is it a matrix, scalar, row or column vector
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jonathan Mendoza
el 6 de Sept. de 2019
Comentada: Stephen23
el 6 de Sept. de 2019
If a variable has the dimension 1 x 1 is it a matrix, scalar, row or column vector. I've tried finding a solution in the book but it doesnt really say.
3 comentarios
John D'Errico
el 6 de Sept. de 2019
Definitely!
Scalars and vectors are all just special cases of a matrix. That is, a vector is a matrix with one row, or one column, depending on the orientation.
A scalar is a vector of length 1. So a scalar is also a 1x1 matrix.
Stephen23
el 6 de Sept. de 2019
One of the things I have always appreciated about MATLAB is how scalars and empty arrays are not special data types: for loops defined over all elements will iterate as many times as the array has elements, as they should. It is easy to test using isscalar or isempty if required, otherwise there is absolutely no reason why a 1x1 vector should be treated any differently than a 1x10 vector.
Respuesta aceptada
Steven Lord
el 6 de Sept. de 2019
dpb and John are correct that the answer is "all of the above". There are functions you can use to check this (see the "Determine Size, Shape, and Order" section on that page) and each describes the criteria an array needs to satisfy for that array to be considered a matrix / scalar / row vector / column vector.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays 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!