Placing Blocks of fixed size to random positions in a bigger matrix
Show older comments
How do you place a smaller matrix(block) of fixed size in a bigger matrix at random positions?
1 Comment
Bharathwaj
on 25 Nov 2011
Accepted Answer
More Answers (1)
Fangjun Jiang
on 16 Nov 2011
a=rand(3);
A=magic(10);
[m,n]=size(a);
[M,N]=size(A);
i=floor((M-m)*rand)+1;
j=floor((N-n)*rand)+1;
A(i+1:i+m,j+1:j+n)=a
1 Comment
Bharathwaj
on 25 Nov 2011
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!