필터 지우기
필터 지우기

Vector search in a loop?

조회 수: 1 (최근 30일)
Daniel
Daniel 2016년 9월 9일
답변: James Tursa 2016년 9월 9일
Hi!
How do i accomplish this, please?'
For exampel: I have d=[1 22 31 41 51 6 7 8 9 10]; z=[1 2 3 4 5 6 7 8 9 10];
Now, i want to search in d for a value of 41. Then, give me that position, which in this case is on fourth column, hence i = 4
Now, go into the z vector and find me the value of column 4 and take that value and place it into Z vector :)
Best regards, Daniel

답변 (1개)

James Tursa
James Tursa 2016년 9월 9일
x = find(d==41);
d(x) = z(x);

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by