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

1 view (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Oct 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}

More Answers (1)

KSSV
KSSV on 4 Oct 2021
A(B) = {[]}

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!