08-07-2012 09:43 AM
Hello,
I have a fixed Array and would like to extract the y-data component from the .txt file that corresponds to the first +/- 5 x-data value compared to the Array input. The output file should contain the original array and the corresponding scanned y-data value.
I am stuck at the point shown in the attached VI file and would like to get any help that you can offer.
I am using LabView 8.5
Thanks,
hiNi
Solved! Go to Solution.
08-07-2012 09:50 AM
Read from the file outside your FOR loop.
Use Index Array to grab the second column of data.
This will give you a 1D array for the FOR loop.
08-07-2012 11:00 AM
Hello,
I got as far as in the attached VI. I am still having a problem in parsing the correct data.
Anymore help will be greatly appreciated.
Thanks,
hiNi.
08-07-2012 11:55 AM - edited 08-07-2012 11:55 AM
You need to grab column 1 from the two columns of your text data using Index Array function.
I am not sure what you are doing with all that additional stuff inside the FOR loop.
Your original FOR loop was just fine and needed to be completed.
08-07-2012 01:41 PM
Hello,
After I grab the y-data, how would I then scan to extract the corresponsing y-data value corresponding to the x-data value (that is within +/-5) of each Array value?? I would like to extract the first y-data value only corresponding to the correct x-compared data.
This is an example that I would like to get out:
120 -0.0493
161.088 -0.0577
202.112 -0.0651....
Thanks,
hiNi
08-07-2012 02:12 PM - edited 08-07-2012 02:14 PM
@hiNI wrote:
Hello,
After I grab the y-data, how would I then scan to extract the corresponsing y-data value corresponding to the x-data value (that is within +/-5) of each Array value?? I would like to extract the first y-data value only corresponding to the correct x-compared data.
This is an example that I would like to get out:
120 -0.0493
161.088 -0.0577
202.112 -0.0651....
Thanks,
hiNi
To be honest, I am not sure what you are trying to do with the +/- 5 . Perhaps I am completely misunderstanding what you want.
08-07-2012 02:21 PM
My apologies...
with the +/-5, I meant that for the first value in the original Array, which is 120, you scan the txt file to find an x-value that is in the limit of +/-5 of 120, i.e, for example, as soon as you hit a value of 115 in the txt file, you extract the y-value data. You then move on the second value in the original Array, which is 161.088. As soon as you hit a x-value that is within +/- 5 of 161.088, (in this case 156), you extract the y-data value. For the first two scans we would get:
120 -0.0493
161.088 -0.0577
on the output array.
Hope this clears up some of your questions.
THANKS for your help so far.
hiNI.
08-07-2012 02:29 PM - edited 08-07-2012 02:29 PM
Why are you using values like 120, 161.088 etc.???
Your data file x-axis values aren't even in the ballpark.
08-07-2012 02:32 PM
True, that is why I was trying to divide each x-value in the text file by 1000000 and then comparing that to the original Array.
Thanks!
08-07-2012 03:03 PM - edited 08-07-2012 03:06 PM
And what were you going to do about the +/- 5 ? Multiply it by 1e+6 as well?
You have x-data 1.0e+8 to 1.45e+8
Anyway, you need one FOR loop inside another FOR loop.
Use FOR loop#1 to loop through your set of predefined array values and use FOR loop #2 to compare each array value all of the x-data array values.
You will need to have the read of you data file outside both FOR loops.