find and store the index value of maximum or minimum value of cell array
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Simon Chan
2022년 10월 3일
[~,idxMax]=cellfun(@max,yourCell); % Index for maximum
[~,idxMin]=cellfun(@min,yourCell); % Index for minimum
댓글 수: 0
Davide Masiello
2022년 10월 3일
편집: Davide Masiello
2022년 10월 3일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!