[英]Matlab turning vectors into a matrix
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] 我不知道该如何表达这个问题,但是我有3个列向量,并且我试图将它们变成一个矩阵,使得矩阵基本上看起来像[v1 v2 v2]
where the length of each vector is obviously more than 1. 其中每个向量的长度明显大于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. 而不是实际数字。
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];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.