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

1 回表示 (過去 30 日間)
Carolina MV
Carolina MV 2018 年 1 月 5 日
編集済み: Eric Lee 2018 年 1 月 5 日
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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by