how to empty the cell of any array whose index is in another matrix

1 visualizzazione (ultimi 30 giorni)
I want to know how to empty the cell of any array, when the index of that particular cell is given in another matrix.
eg: I have an array as
A={[1 2], [10 11], [15 12], [16 17], [18 2]}
a matrix having index as
B=[2 3 5]
Now i want to empty the cells with index given in matrix B and want an output as:
A={[1 2],[ ], [ ], [16 17], [ ]}
I am a begineer in MATLAB, so pardon me if my question is not clear.

Risposta accettata

Walter Roberson
Walter Roberson il 4 Ott 2021
A={[1 2], [10 11], [15 12], [16 17], [18 2]}
A = 1×5 cell array
{[1 2]} {[10 11]} {[15 12]} {[16 17]} {[18 2]}
B=[2 3 5]
B = 1×3
2 3 5
A(B) = {[]}
A = 1×5 cell array
{[1 2]} {0×0 double} {0×0 double} {[16 17]} {0×0 double}

Più risposte (1)

KSSV
KSSV il 4 Ott 2021
A(B) = {[]}

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by