How to find the location of a value in a array?

2 visualizaciones (últimos 30 días)
Avi
Avi el 4 de Jun. de 2018
Comentada: Jan el 5 de Jun. de 2018
I have four sets of values y(211*61), z(211*61), pyy(1*211), pzz(1*211). Please refer the attached excel file. I have to locate for every value in pyy and pzz two values(one greater than and one less than y and z respectively) for every row of y and z.
For the location, values both in y and z must satisfy the condition. Now, consider the first value in pyy is 0 and in pzz is -138.5. then, for the corresponding values, I get the location in 1st row of y and z as 46 and 47th column number.
In every y and z row the condition is satisfied twice,but it is satisfied together only at one location as can be seen from the example above.
Any help would be appreciated. Thanks in advance.
  3 comentarios
Avi
Avi el 4 de Jun. de 2018
Actually I found a problem with the values. I will solve it first and get back. Thanks for the help.
But the condition that i was talking about was,
The condition is to find the location in each row of y and z , the values less then and greater then each corresponding value of pyy and pzz. Consider the value pyy(1) = 0. Now, we have to locate the two values in y(1,61) those are in the proximity of 0, which occurs twice at columns 16 & 17 and 46 & 47.
similarly, when we find the two set of values in proximity of pzz = -138.5. There will be two sets of values.
Then, from the two set of values for y and z, one set is same for both, here 46 and 47th.
Jan
Jan el 5 de Jun. de 2018
Is your problem solved? If not, I have to admit, that I do not understand the explanation:
  • Values cannot be "less then and greater then". Do you mean: "not equal"?
  • "the two values in y(1,61)" - y(1, 61) is a scalar, such that it cannot contain 2 values.
  • What does "in the proximity of 0" mean?
  • "from the two set of values for y and z, one set is same for both, here 46 and 47th." - I have no clue, what this means.

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by