필터 지우기
필터 지우기

How do you get the row or column of something you need?

조회 수: 1 (최근 30일)
Shawn Simon
Shawn Simon 2015년 11월 28일
댓글: Shawn Simon 2015년 11월 28일
For example, if you had:
abc
def
ghi
Say I wanted the row and column of 'e', how would I do this? I have been looking everywhere for this and I just can't seem to find it. Please help. Thank you!

채택된 답변

Image Analyst
Image Analyst 2015년 11월 28일
[rows, columns] = find(yourMatrix == e); % e is an integer.
  댓글 수: 5
Walter Roberson
Walter Roberson 2015년 11월 28일
You decide which position is the "first" one, and you index rows() and columns() at that same index. But how do you define which is the "first" ?
AB
BD
which 'B' is 'first' ?
Shawn Simon
Shawn Simon 2015년 11월 28일
The way that I want to implement this, is with a wordsearch. I have a 15x15 2 dimensional array filled with letters. I have created a function that runs checks throughout the array looking for the word a user inputs. With this, I am to return the row and column of the first letter of the word. So it would be like this:
iuwekfasdkuhwqa
kjdfjdjilihvjut
injmatlabiliwtm
ijghaddndldndld
And so on. The user would then use the function I created and input a word, in this case 'matlab'. The function would then output the row and column of 'm' (3rd row; 4th column). If you would like to see my code, I would gladly show you.

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

추가 답변 (0개)

카테고리

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