Is a matrix same as a vector in MatLab? -- MatLab
Is a matrix same as a vector in MatLab? -- MatLab
Is a matrix same as a vector in MatLab?
[Ans]
No
[NOTE]
But I found and interesting thing.
A vector will be recognized as a vector and a matrix.
i.e.
For a vector named vec, isvector(vec) will return true and ismatrix(vec) will return true.
Look at following example(code and output).
code:
clear
clc
A=[1:3:7;1:2:5]
fprintf("A: Is it a matrix?"+ismatrix(A)+"\t"+"Is it a vector?"+isvector(A));
fprintf("\n");
vec=[1:2:8]
fprintf("vec: Is it a matrix?"+ismatrix(vec)+"\t"+"Is it a vector?"+isvector(vec));
fprintf("\n");
output:
A =
1 4 7
1 3 5
A: Is it a matrix?true Is it a vector?false
vec =
1 3 5 7
vec: Is it a matrix?true Is it a vector?true
A =
1 4 7
1 3 5
A: Is it a matrix?true Is it a vector?false
vec =
1 3 5 7
vec: Is it a matrix?true Is it a vector?true
Comments
Post a Comment