Matlab将矢量转换为矩阵(Matlab turning vectors into a matrix)
我不确切地知道如何用这个问题来表达,但我有3个列向量,我试图将它们变成矩阵,这样矩阵基本上看起来像[v1 v2 v2]
其中每个向量的长度明显大于1。
有自动方法吗?
现在,我要走了
matrix{1} = v1;
matrix{2} = v2;
matrix{3} = v3;
但这不起作用,因为当我打印出我的矩阵时,我得到了
matrix =
[50x1 double] [50x1 double] [50x1 double]
而不是实际的数字。
I don't know exactly how to phrase this question, but I have 3 column vectors, and I'm trying to turn them into a matrix such that, the matrix would basically look like [v1 v2 v2]
where the length of each vector is obviously more than 1.
Is there an automatic way to do this?
Right now, I'm going
matrix{1} = v1;
matrix{2} = v2;
matrix{3} = v3;
but this doesn't work work, because when I print out my matrix I get
matrix =
[50x1 double] [50x1 double] [50x1 double]
instead of the actual numbers.
原文:https://stackoverflow.com/questions/12850745
2020-07-04 09:07
满意答案
假设您的列向量定义为:
>>v1 = [1; 2; 3];
>>v2 = [4; 5; 6];
>>v3 = [7; 8; 9];
那么你的矩阵就是这些列的行向量:
>>m = [v1 v2 v3];
Let's say your column vectors are defined as:
>>v1 = [1; 2; 3];
>>v2 = [4; 5; 6];
>>v3 = [7; 8; 9];
Then your matrix is simply a row vector of these columns:
>>m = [v1 v2 v3];
2013-02-21
相关问答