필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can anyone help with code for this problem

조회 수: 1 (최근 30일)
Xanm ft
Xanm ft 2020년 1월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
How do you write code to find row/column of first time a number appears in matrix
Eg for [ 1 2 2; 3 3 5;6 6 7; 5 3 3;4 5 4]
The first time 4 appears is in the first column of the fifth row. Is there a way to code for this to solve this in a massive matrix?

답변 (1개)

Walter Roberson
Walter Roberson 2020년 1월 8일
unique() with first and second outputs and 'first' option.
The first output will be a list of values. The second will be the corresponding linear index.
You might want to ind2sub() the linear indices.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by