MATLAB: Need to combine two matrix combine two matrix Hi, I have two matrices P= 1 2;3 4;5 6; Q= 7 8;9 10;11 12; I want the result R= {[1 7] [2 8]; [3 9] [4 10]; [5 11] [6 12]}; Can any one help me? Best Answer How about the following?R = mat2cell([P(:) Q(:)],ones(1,numel(P)))R = reshape(R,[],2); Related SolutionsMATLAB: How to merge two matrix into single matrix . two matrix is of size 270×13 into single matrix of 270×26 .this can be done by merging the cells alternatively.a=[1 2 3 4],b=[5 6 7 8],c=[1 5 2 6 3 7 4 8].is there any command available in matlab.help me Use a = [1 2 3 4 5 6]; b = [7 8 9 10 11 12]; c = reshape([a;b],1,[]) MATLAB: How can i simultaneously reference in cells This is fun... you can tryC{1}=[1 2;3 4;5 6]C{2}=[7 8;9 10;11 12]g = @(j)[C{1}(j,:);C{2}(j,:)]'; % function handleD = arrayfun(g,1:3,'UniformOutput',false); % awesome function Related QuestionHow to convert an array to a matrixDetermine the loop which satisfies the particular condition.Cell to double problem for loop includes cellarrays.Reshaping a a matrixRemove cell array content matrix with condition: length of element in cell smaller than specific valuePlace each dimension of matrix into a cell array
Best Answer