Finding Values in a file

조회 수: 6 (최근 30일)
Chris Dan
Chris Dan 2019년 12월 23일
댓글: Walter Roberson 2019년 12월 24일
Hello, I have a file named as " model_data".
talha3.JPG
In the first column, there are different values from 0 to 0.1216. I want to develop a program in such a way that if a user enters a value of 0.1 The program should tell the user in which row/ or in between which rows the value lies of the first column.
  댓글 수: 3
Chris Dan
Chris Dan 2019년 12월 24일
I tried this line
X = find (0.0751 == model_data( :,1));
it gives me the answer 3, but when I try 0.1, I donot get any answer, where as I should be getting 3 and 4, because in between them 0.1 lies
Walter Roberson
Walter Roberson 2019년 12월 24일
The == operator is a bit-for-bit exact comparison . Your table entry probably only displays as 0.0751 and is probably not 0.075100000000000000088817841970012523233890533447265625 exactly like a hard-coded 0.0751 is.

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

답변 (1개)

Chris Dan
Chris Dan 2019년 12월 24일
X = find (0.0751 > model_data( :,1));
Y = find (0.0751 <model_data( :,1));
I kind of got the answer, we get two variables and then we can choose their data values, which we want, like
Y(1,1),Y(2,1), Y(3,1)
X(1,1),X(2,1), X(3,1)
and that will be our answers

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by