MATLAB: Matrix formed by Vectors?Easy question. matrix formed by vectors I have a matrix size=10×10. And I want to obtain each column as a vector. Or vectors will create a matrix. How can I do that? Thanks in advance. Best Answer Yup, simple:M =randn(10);for i1 = 1:size(M;2) V{i1} = M(:,i1);endThen you have your vectors in the cells of V.The other direction:M = [v1,v2,v3,....,vN];There vN has to be column vectors.HTH Related SolutionsMATLAB: Building matrix using vectors?Easy question. Depending what you have: 1) matrix = [row_vector1;row_vector2; ... row_vectorn]; 2) matrix = [col_vector1, col_vector2, ... col_vectorn]'; 3) matrix(row_number1,:) = vector1; matrix(row_number2,:) = vector2; matrix(row_number3,:) = vector3; MATLAB: How to concatenate string vectors of unequal length Try this:% Define component cell arrays.v1 = {'a'; 'b'; 'c'}v2 = {'d'}v3 = {'e'; 'f'}% Find out how big cell array needs to be.lv1 = length(v1);lv2 = length(v2);lv3 = length(v3);rows = max([lv1,lv2,lv3])% Instatiate cell array of the max size.v4 = cell(rows, 3)% stuff each column in.v4(1:lv1, 1) = v1;v4(1:lv2, 2) = v2;v4(1:lv3, 3) = v3;% Print out resultsfprintf('\n\nHere is the output cell array:\n');v4In the command window:Here is the output cell array:v4 = 'a' 'd' 'e' 'b' [] 'f' 'c' [] [] Related QuestionSimple vector question.Fill a vector with two vectorsFind the maximum value in different vectors and from which vector is itSimple vector question.
Best Answer