MATLAB: Saving matrix elements into array matrix arrayurgent Hi, I have 9 matrices with size 500×2. I would like to save them into a 3×3 array; i.e. my first 500×2 matrix be the first element of my 3×3 matrix and so on. Can you please help me? Best Answer You can use a cell array for thisX = cell(3,3)X{1,1} = My500by2Matrix1 ;% etc... or use a 4D matrixX = zeros(3,3,500,2) ;X(1,1,:) = My500by2Matrix1 ;% etc.% and use squeeze to obtain a particular matrixsqueeze(X(3,2,:,:)) Related SolutionsMATLAB: How do you turn a 30x30x24 matrix into a 24×900 matrix Well, you couldreshape(YourMatrix, size(YourMatrix,3), [])but it is quite unlikely that is what you want. You probably wantreshape(permute(YourMatrix, [3 1 2]), size(YourMatrix,3), [])This would take each original 30 x 30 plane of numbers and make it into a row. MATLAB: Element Wise Multiplication for varying matrix sizes FirstMatrix .* repmat(SecondVector, size(FirstMatrix,1), 1) Related QuestionQUestion regarding Number of elements in a cellGoing from 1 x n to n x n matrixHow to convert a 1x1x50 matrix to a vector
Best Answer