How do I delete multiple elements from a column array using a while loop?

1 Ansicht (letzte 30 Tage)
Brandon Murray
Brandon Murray am 7 Nov. 2019
Kommentiert: Jan am 7 Nov. 2019
For example if I wanted to delete every element in an array where the array is equal to 0?

Antworten (1)

Shubham Gupta
Shubham Gupta am 7 Nov. 2019
Bearbeitet: Shubham Gupta am 7 Nov. 2019
This should do the job:
A = [1 0 1 0 1 0 1 0]';
A(A==0) = []

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by