Effacer les filtres
Effacer les filtres

I need to iterate through a vector, A, using a while loop. Although, I must replace every negative element with 0 until I reach an element with value 0 or checked all elements in the vector.

1 vue (au cours des 30 derniers jours)
I also must use either for or while to solve the problem. Also I am given an example: A=[1 -2 3 -5 4 0 9], then the scripts will change it into A=[1 0 3 0 4 0 9] If anyone could help much would be appricated.

Réponses (1)

Image Analyst
Image Analyst le 28 Sep 2018
Looks up rem, for, and mod in the help.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by