Arrays, indices problem
OK, first of all I would like to say hello to everyone since this is my first post here, didn't know that this forum exists, nice to be here
Here's the thing...
I have to arrays: time and voltage, both of them containing data
the problem is that I am looping through time and fetching the appropriate value of voltage like this:
- first getting the index of the time value in a time array
- and then getting the voltage value from a voltage array by the index
The problem is the following, some particular value of time exists in the array but 'find' method doesn't return the right result, rather it returns 1x0 matrix, so it returns null...
What and where can be the problem...Even when I type :
index = find (time_array == 1.2345) it returns 1x0 matrix
and the value of 1.2345 exists in the matrix!!
Please help me cause I've tried debugging it but was unfortunate
Is it possible that no one knows the solution to my problem?
Let me simplify it:
time = [ 1.1 1.2 1.3 1.4 1.5]
voltage = [2 4 5 6 7]
if I type:
index = (time=1.1)
which should return 1
it return me:
Empty matrix 1 by 0
what could be the problem? for some numbers it works but for some it does not! is there any other way to fetch the index of some value in a matrix besides the "find" method.
please help and that u in advance
Welcome to Math Help Forum!
I presume you are referring to a programming problem here. What language are you using? Can you show us the code that you've tried?
Perhaps someone here may be able to help if you could give us some more details.