I have a 180×180 matrix of 0's and I was to assign different range of random integers to each 45×45 set in the matrix. I have show the example output that I want for a much smaller matrix (10×10) that breaks it up into 5×5 matrices of different random values below. Any easy way to do this that doesn't involve a million for loops? I just want to expand this code to an N = zeros(180,180) type deal with 45×45 subparts.
N = zeros(10,10);for i = 1:5 for j = 1:5 N(i,j) = randi([1,10]); endendfor i = 1:5 for j = 6:10 N(i,j) = randi([15,100]) endendfor i = 6:10 for j = 6:10 N(i,j) = randi([1,17]) endendfor i = 6:10 for j = 1:5 N(i,j) = randi([100,250]) endendN
Best Answer