Generating random blocks of 7-by-7 pixels from a multidimensional array 700 x 800 x 6.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chandrama Sarker
el 18 de Jul. de 2017
Comentada: Walter Roberson
el 18 de Jul. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 18 de Jul. de 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 comentarios
Walter Roberson
el 18 de Jul. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!