MATLAB: Large special matrix matrix array Hello I need a way to create a 4,030,464 element matrix that is 4096 x 984 elements and numbered 1 to 4030464. I cannot think of an easy way to create this besides a brute force method. Any ideas? Thank you Best Answer Use this example:reshape(1:10,5,2) Related SolutionsMATLAB: Special sorting Do not use "input" as name of a variable, because it is a name of a built-in function.in = [2, 2, 5, 6, 6, 6, 1, 1, 1, 1, 4, 3, 3];out = cumsum([1, diff(a) ~= 0]);>> out = [1 1, 2, 3, 3, 3, 4, 4, 4, 4, 5, 6, 6] MATLAB: Assigning values to an array using elements of another array after each element goes through a check I think your looking for something like thisstart_matrix = rand(5,5); %rand 5x5, values between 0 and 1 (cause whats the point in comparing zeros)end_matrix = zeros(size(start_matrix)); %same size as starting matrixfor i = 1:size(start_matrix,1) for j = 1:size(start_matrix,2) if (start_matrix(i,j) > 0.5) end_matrix(i,j) = start_matrix(i,j) * 666; %some crazy calculations else end_matrix(i,j) = start_matrix(i,j); %no crazy calculations if <= 0.5 end endendend_matrix Related QuestionSpecial legend for special bar plotSingleton dimention as last dimension in matrixComparing two matrices, and acting upon the result element by element.Special xlswrite saveCommand to reshape matrix diagonallyReshape matrix (Special case)
Best Answer