Hi, I want to find a number in a matrix. For example, I have an array x=1:10 and I want to find a number 4 in this array and get value of cell and row in matrix. How can I do this?

 채택된 답변

Harshit
Harshit 2012년 11월 21일

0 개 추천

댓글 수: 6

Andrew
Andrew 2012년 11월 21일
thank you! I have done it before but there was a problem, because I tried to find a non-exist number =)
VISHAL BARUN
VISHAL BARUN 2017년 9월 28일
found a solution yet?
ANA ROSHAN
ANA ROSHAN 2020년 2월 13일
go to the help of matlab.
ANA ROSHAN
ANA ROSHAN 2020년 2월 13일
go to the help of matlab.
Soong Yuan See
Soong Yuan See 2020년 2월 25일
ya i am also trying to check if a number appear in the array or matrix before anot.
Soong Yuan See
Soong Yuan See 2020년 2월 25일
p = [11 10 2 1 5 7 4]
%check if the matrix contain number 5
contains5 = any(p(:) == 5)
if yes it will show 1 else 0
hope this is helpful

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

질문:

2012년 11월 21일

댓글:

2020년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by