MATLAB: How to assign values to 100 by 2 matrix MATLABmatrix I have a matrix (2,3); how could I initialize a 100 by 2 matrix with the first column all=2 and second column all=3. Thank you! Best Answer By the looks of the question probably you want:% if you want first columns with 2 and the other as 3 thenones(100,2).*[2,3] % since 2016bbsxfun(@times,ones(100,2),[2,3]) % prior 2016bBy basic indexing [if you want to feed in the 2 by 3 matrix to a 100 by 2 matrix] then:https://in.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html :a=rand(2,3); % example[m,n]=size(a);b=zeros(100,2);b(1:n,:)=a' Related SolutionsMATLAB: Matrix manipulations of columns A=random('norm',3,0.2,100,100)A(:,2:2:end)=ones(size(A(:,2:2:end))) MATLAB: Going from 1 x n to n x n matrix repmat(A,100,1)where A is your vector. Related QuestionHello, I want to merge a big matrices row by rowHow to write a matrix based from three columns of data using the first two columns as referencesHow to convert cell in matrix
Best Answer