how to find the closest values with tolerance in a matrix given a specific value

조회 수: 131 (최근 30일)
Hi everyone, i have a problem finding values with tolerance in a matrix.In more detail, i have a 601x2201 matrix that contains option values, all i want is to find the closest values to 185.2 with +-0.02 tolerance and their indexes in the matrix.i have tried some codes to solve this(ismember,find,...) but always i end up with no answer.i would appriciate any help.Thank you for your time.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 9월 6일
A=1000*rand(601,2201) ; % Example

추가 답변 (1개)

kostas zervos
kostas zervos 2016년 9월 6일
Thank you guys,you saved me!!!both answers are very helpful!!!
  댓글 수: 1
michio 2016년 9월 6일
편집: michio 님. 2016년 9월 6일
If you are using R2015b or later, ismembertol function could also be of help.

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


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