I have two files named TData (j) (technical Data) and RData (i) in an array format. I also have a file NFile (i), which is supposed to specify an operation condition as follows. If an index of NFile is greater than 1, we define a newfile, NewRData (i) as the value of TData (j) that is IMMEDIATELY less than or equal to RData(i).
I have written the following code and the code seems to stop at the last value of the TData instead of the immediate less value of TData.
RData =[0.443 0.641 0.641 0.641 0.641 0.641]
NFile= [0.93 0.95 0.97 0.99 1.02 1.01]
TData =[1.2 0.87 0.64 0.44 0.32 0.25 0.21]
based on the above file, my NewR should be [0.443 0.641 0.641 0.641 0.44 0.44]
However my program give NewR as [0 0 0 0 0.21 0.21]. Kindly help me trouble shoot it. What am I missing?