LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan from array and compare

Solved!
Go to solution

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

Download All
0 Kudos
Message 1 of 15
(4,352 Views)

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.

 

 

0 Kudos
Message 2 of 15
(4,347 Views)

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.

0 Kudos
Message 3 of 15
(4,318 Views)

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.

 

0 Kudos
Message 4 of 15
(4,302 Views)

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 

0 Kudos
Message 5 of 15
(4,294 Views)

@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.

 

 

 

 

0 Kudos
Message 6 of 15
(4,290 Views)

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.

0 Kudos
Message 7 of 15
(4,281 Views)

Why are you using values like 120, 161.088 etc.???

Your data file x-axis values aren't even in the ballpark.

 

 

 

 

0 Kudos
Message 8 of 15
(4,270 Views)

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!

0 Kudos
Message 9 of 15
(4,264 Views)

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.

 

 

0 Kudos
Message 10 of 15
(4,251 Views)