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

1 次查看(过去 30 天)
I want to create a for loop that stores indexes, if a certain condition verefies, in a vector.

回答(1 个)

Eric Lee
Eric Lee 2018-1-5
编辑:Eric Lee 2018-1-5
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);

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by