find and store the index value of maximum or minimum value of cell array
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i have cell of size 613x1 and each cell has 200x1 column in it . i want to find out the index location of maximum and minimum of each column in cell and store it in different vector. further i want to split the cell based on these index location.
0 comentarios
Respuestas (2)
Simon Chan
el 3 de Oct. de 2022
[~,idxMax]=cellfun(@max,yourCell); % Index for maximum
[~,idxMin]=cellfun(@min,yourCell); % Index for minimum
0 comentarios
Davide Masiello
el 3 de Oct. de 2022
Editada: Davide Masiello
el 3 de Oct. de 2022
Example
for row = 1:613
yourcellarray(row,1) = {randi(100,200,1)};
end
yourcellarray
yourcellarray{1}
Above is just an example of the type of cell array you have described. Now, to find the index of the maximum and minimum for each cell, you just need to do
[~,idxMax] = cellfun(@max,yourcellarray)
[~,idxMin] = cellfun(@min,yourcellarray)
Regarding splitting the cell array based on the index of the maximum you need to give more info.
0 comentarios
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices 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!