if a variable has the dimension 1 x 1 is it a matrix, scalar, row or column vector
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonathan Mendoza
am 6 Sep. 2019
Kommentiert: Stephen23
am 6 Sep. 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 Kommentare
John D'Errico
am 6 Sep. 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
am 6 Sep. 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.
Akzeptierte Antwort
Steven Lord
am 6 Sep. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!