Delete some columns from a cell array depending on an array SP

1 回表示 (過去 30 日間)
luca
luca 2019 年 10 月 15 日
コメント済み: luca 2019 年 10 月 15 日
Given the cell array
V={{[1,1,1,1;25,45,70,90],[2,2,2,2;78,112,146,180],[3,3,3,3;93,127,161,195],[4,4;70,100],[],[6;85],[],[],[9,9;85,110]},{[],[2,2,2,2;73,107,141,175],[3,3,3,3;83,117,151,185],[4,4,4,4;65,85,105,125],[],[6;85],[],[],[9,9,9;80,105,130]}};
and the array
SP= [1 2 3 4 6 9];
I want to remove from the cells V the column that are not in SP.so column 5 7 8. obtaining
V={{[1,1,1,1;25,45,70,90],[2,2,2,2;78,112,146,180],[3,3,3,3;93,127,161,195],[4,4;70,100],[6;85],[9,9;85,110]},{[],[2,2,2,2;73,107,141,175],[3,3,3,3;83,117,151,185],[4,4,4,4;65,85,105,125],[6;85],[9,9,9;80,105,130]}};
May someone help me?
  3 件のコメント
Guillaume
Guillaume 2019 年 10 月 15 日
Yes.
The [] around SP are pointless though.
luca
luca 2019 年 10 月 15 日
Thanks!

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

回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by