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

1 次查看(过去 30 天)
For example if I wanted to delete every element in an array where the array is equal to 0?

回答(1 个)

Shubham Gupta
Shubham Gupta 2019-11-7
编辑:Shubham Gupta 2019-11-7
This should do the job:
A = [1 0 1 0 1 0 1 0]';
A(A==0) = []

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by