MATLAB Answers

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

3 ビュー (過去 30 日間)
Brandon Murray
Brandon Murray 2019 年 11 月 7 日
コメント済み: Jan 2019 年 11 月 7 日
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) = []

Community Treasure Hunt

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

Start Hunting!

Translated by