Generating random blocks of 7-by-7 pixels from a multidimensional array 700 x 800 x 6.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chandrama Sarker
le 18 Juil 2017
Commenté : Walter Roberson
le 18 Juil 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 commentaires
Réponse acceptée
Walter Roberson
le 18 Juil 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 commentaires
Walter Roberson
le 18 Juil 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resource Allocation Modeling dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!