Finding Values in a file

5 visualizaciones (últimos 30 días)
Chris Dan
Chris Dan el 23 de Dic. de 2019
Comentada: Walter Roberson el 24 de Dic. de 2019
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 comentarios
Chris Dan
Chris Dan el 24 de Dic. de 2019
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 el 24 de Dic. de 2019
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.

Iniciar sesión para comentar.

Respuestas (1)

Chris Dan
Chris Dan el 24 de Dic. de 2019
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

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by