How to build a loop through every column and row of a cell
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Julia Gorman
el 25 de Jul. de 2022
Respondida: Voss
el 25 de Jul. de 2022
I have a 32 x 3 MATLAB cell and I want to loop through every one of the 96 cells to find the single largeset value contained in all of them? How might I go about doing that.
0 comentarios
Respuesta aceptada
Voss
el 25 de Jul. de 2022
% first, I create a 32x3 cell array of random 10x10 matrices
C = arrayfun(@(x)randn(10),zeros(32,3),'uni',false)
% now loop through all the cells and store
% the largest value in each cell
C_max = zeros(size(C));
for ii = 1:numel(C)
C_max(ii) = max(C{ii}(:));
end
C_max
% finally, the single largest value
C_max = max(C_max(:))
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements 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!