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

2 visualizaciones (últimos 30 días)
Carolina MV
Carolina MV el 5 de En. de 2018
Editada: Eric Lee el 5 de En. de 2018
I want to create a for loop that stores indexes, if a certain condition verefies, in a vector.

Respuestas (1)

Eric Lee
Eric Lee el 5 de En. de 2018
Editada: Eric Lee el 5 de En. de 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);

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by