how to convert 1D element into 2D element in a matirx?

조회 수: 1 (최근 30일)
sheno39
sheno39 2013년 10월 17일
댓글: Andrei Bobrov 2013년 10월 18일
hi, i need to find the location of elements in a matrix as (row,column) value. what function is used to get the row and column of a element?
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 17일
Your title does not match the content of your question
sheno39
sheno39 2013년 10월 17일
sir, i need to find the row,column value for each element in a matrix

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 17일
편집: Azzi Abdelmalek 2013년 10월 17일
Use find function
doc find
Example
A=[1 2 3;4 5 6;7 8 9]
[ii,jj]=find(A)

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 10월 17일
A = [4 0 3 0
4 4 4 -3
-3 -3 2 -3
5 0 -1 5]
s = size(A);
[irow,icol] = ndgrid(1:s(1),1:s(2));
out = [irow(:),icol(:),A(:)];
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 18일
Can you explain, for example, why, for locatn(1,5) , it should be 17 and not 3

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by