Generating random blocks of 7-by-7 pixels from a multidimensional array 700 x 800 x 6.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Chandrama Sarker
am 18 Jul. 2017
Kommentiert: Walter Roberson
am 18 Jul. 2017
Hi, I am new in the programming field and encounter a problem while coding to generate 100 random blocks of 7x7 pixels from a multidimensional array with a size of 700x800x6.Any help in this regard will be highly appreciated
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 18 Jul. 2017
Easy way: loop
Trickier way:
See https://www.mathworks.com/matlabcentral/answers/348465-hello-been-trying-to-extract-array-from-a-big-matrix-so-because-of-that-taken-magic-5-but-issue-is#comment_468693 and https://www.mathworks.com/matlabcentral/answers/348500-extracting-last-non-nan-200-columns-from-matrix-with-varying-number-of-nans-ending-the-rows#answer_273971 where I show how to extract different columns for each row.
2 Kommentare
Walter Roberson
am 18 Jul. 2017
The trickier way is not recommended for beginners!
for K = 1 : 100
r = randi(700-6,1,1);
c = randi(800-6,1,1);
rb{K} = YourData(r:r+6, c:c+6, :);
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resource Allocation Modeling finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!