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

1 view (last 30 days)
For example if I wanted to delete every element in an array where the array is equal to 0?

Answers (1)

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

Categories

Find more on Loops and Conditional Statements 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!