フィルターのクリア

how can I extract first number of cell?

2 ビュー (過去 30 日間)
skysky2000
skysky2000 2017 年 6 月 16 日
コメント済み: skysky2000 2017 年 7 月 4 日
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

採用された回答

C.J. Harris
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 件のコメント
skysky2000
skysky2000 2017 年 7 月 4 日
thanks alot sorted it out

サインインしてコメントする。

その他の回答 (1 件)

skysky2000
skysky2000 2017 年 6 月 16 日
That amazing Harris . thanks alot

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by