|
9 m( K4 M( i! O4 R' X# ?
联用cellfun,arrayfun等函数( Y2 ~. j7 t1 x8 D* H1 e
c = cell(3,3);
( s2 A2 J. h/ z* N" e1 r' b" Ic{1,1} = rand(1,2);
- q% D0 O" X! t2 f6 Ec{2,1} = rand(1,4);$ G) y% E$ ]% ] s
c{2,2} = rand(1,3);
% |( o* Y7 r6 ]& a* tc{3,2} = rand(1,5);2 {4 C8 C, K9 B: i
c{3,3} = rand(1,6);- C/ X1 r' B4 E4 i- i7 W
idx = find(~cellfun(@isempty,c)); e% g4 h7 _: z4 G% _) [
result = arrayfun(@(ii) c{idx(ii)}, [1:1:numel(idx)],'UniformOutput', false)
0 P, A/ e) h# Z) e5 p复制代码! D+ b) j* {. v2 x( h
2 M6 C/ ~) H2 M1 ?& O
result =; P) `! d) g8 b
1×5 cell 数组
6 ^* [" [% ]0 _# a$ _ {1×2 double} {1×4 double} {1×3 double} {1×5 double} {1×6 double} |
|