How to can I create a vector in the for loop?

2 vues (au cours des 30 derniers jours)
Carolina MV
Carolina MV le 5 Jan 2018
Modifié(e) : Eric Lee le 5 Jan 2018
I want to create a for loop that stores indexes, if a certain condition verefies, in a vector.

Réponses (1)

Eric Lee
Eric Lee le 5 Jan 2018
Modifié(e) : Eric Lee le 5 Jan 2018
For matrix x with condition x==9, indices where conditions are met are found and stored in vector v as follows:
x=magic(5);
v=find(x==9);

Catégories

En savoir plus sur Matrix Indexing 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