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 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