determine which cells have more than 1 row
조회 수: 3 (최근 30일)
이전 댓글 표시
How can I find out the number of rows within a cell of a cell array
e.g. the cell array below, its first cell has 2 rows, I can't see online how to find out which rows have 2 etc
sectout =
8×1 cell array
[2×6 double]
[1×6 double]
[2×6 double]
[2×6 double]
[2×6 double]
[1×6 double]
[1×6 double]
[1×6 double]
Any ideas?
댓글 수: 0
채택된 답변
추가 답변 (1개)
KSSV
2017년 7월 26일
Run a loop and get the dimensions.
% make a random cell
K = cell(8,1) ;
for i = 1:8
K{i} = rand(randperm(10,1),randperm(10,1)) ;
end
%%Get number of rows
R = zeros(size(K)) ;
for i = 1:8
R(i) = size(K{i},1) ;
end
Or single line....below line gives dimensions of K...first column will be your rows..
R1 = cell2mat(cellfun(@size,K,'un',0)) ;
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!