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

1 Ansicht (letzte 30 Tage)
luca
luca am 15 Okt. 2019
Kommentiert: luca am 15 Okt. 2019
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 Kommentare
Guillaume
Guillaume am 15 Okt. 2019
Yes.
The [] around SP are pointless though.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by