how can I extract first number of cell?
3 ビュー (過去 30 日間)
古いコメントを表示
Dear All, I am facing problem that I have cell a ={[8,21,291,94,455,241,227,36,130] [15,248,455,241,227,36,130] [21,291,94,455,241,227,36,130] [36,130]} the question is: 1- how can I extract first number of each cell and put it as vector, expect answer is : c= [8 15 21 36];
2- how can I delete the first element of each cell and make others as vector without first element, expect answer is: d=[21,291,94,455,241,227,36,130,248,455,241,227,36,130,291,94,455,241,227,36,130,130]
Hope can you help me, Thanks alot
0 件のコメント
採用された回答
C.J. Harris
2017 年 6 月 16 日
a ={[8,21,291,94,455,241,227,36,130] [15,248,455,241,227,36,130] [21,291,94,455,241,227,36,130] [36,130]};
Question 1:
c = cell2mat(cellfun(@(x)(x(1)), a, 'UniformOutput', false));
Question 2:
d = cell2mat(cellfun(@(x)(x(2:end)), a, 'UniformOutput', false));
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!