From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract data from array to different plots

Solved!
Go to solution

Hello,

 

I have collected data in the format:

 

Temp:25 Freq: 136 100 99.993 2998.581 0
Temp:25 Freq: 136 125.89 125.991 2997.196 -0.004
Temp:25 Freq: 136 158.48 158.007 2995.1 -0.01
Temp:25 Freq: 136 199.52 200.002 2991.905 -0.019
Temp:25 Freq: 155 100 100.005 3000.866 0.003
Temp:25 Freq: 155 125.89 126.003 3000.086 0.000
Temp:25 Freq: 155 158.48 157.985 2996.133 -0.011
Temp:25 Freq: 155 199.52 200.018 2992.644 -0.021
Temp:25 Freq: 174 100 100 3001.405 0.000
Temp:25 Freq: 174 125.89 126.016 2997.996 -0.010
Temp:25 Freq: 174 158.48 158.013 2996.371 -0.015
Temp:25 Freq: 174 199.52 199.983 2992.315 -0.026
Temp:-30 Freq: 136 100 99.993 2998.581 0
Temp:-30 Freq: 136 125.89 125.991 2997.196 -0.004
Temp:-30 Freq: 136 158.48 158.007 2995.1 -0.01
Temp:-30 Freq: 136 199.52 200.002 2991.905 -0.019
Temp:-30 Freq: 155 100 100.005 3000.866 0.003
Temp:-30 Freq: 155 125.89 126.003 3000.086 0.000
Temp:-30 Freq: 155 158.48 157.985 2996.133 -0.011
Temp:-30 Freq: 155 199.52 200.018 2992.644 -0.021
Temp:-30 Freq: 174 100 100 3001.405 0.000
Temp:-30 Freq: 174 125.89 126.016 2997.996 -0.010
Temp:-30 Freq: 174 158.48 158.013 2996.371 -0.015
Temp:-30 Freq: 174 199.52 199.983 2992.315 -0.026
Temp:+70 Freq: 136 100 99.993 2998.581 0
Temp:+70 Freq: 136 125.89 125.991 2997.196 -0.004
Temp:+70 Freq: 136 158.48 158.007 2995.1 -0.01
Temp:+70 Freq: 136 199.52 200.002 2991.905 -0.019
Temp:+70 Freq: 155 100 100.005 3000.866 0.003
Temp:+70 Freq: 155 125.89 126.003 3000.086 0.000
Temp:+70 Freq: 155 158.48 157.985 2996.133 -0.011
Temp:+70 Freq: 155 199.52 200.018 2992.644 -0.021
Temp:+70 Freq: 174 100 100 3001.405 0.000
Temp:+70 Freq: 174 125.89 126.016 2997.996 -0.010
Temp:+70 Freq: 174 158.48 158.013 2996.371 -0.015
Temp:+70 Freq: 174 199.52 199.983 2992.315 -0.026

 

I am able to extract specific data and plot a graph for the different Freqs (see "array extract from pivot file_for email.VI).  I would like some help to be able to now make a plot at a fixed Freq but different Temps (so plot will have 3 graphs:25, -30, +70 for the same freq say 136).

 

Thanks for your help and time,

hiNi.

0 Kudos
Message 1 of 11
(2,653 Views)

I would recommend sortting the array by frequency.  Then as you iterate through the array, check the freq to see if it matches the desire freq, then check the temp to see where the data should be directed. At first, I would generalize this by using a 2D array, that way you can add a new column to the 2D array each time you encounter a new temperature at the desired frequency, enabling the code to handle any number of temperatures (not just three as in your example).  

 

Unless, of course, you are garaunteed to have only three temperatures.  then you can just use 3 separate 1D arrays.

Message 2 of 11
(2,626 Views)

Hello,

 

I was able to extract the rows and colums for a specific frequency.  Can you assist me in getting the 3 different plots (the 3 different temps) to show up on the graph?

 

Thanks,

hiNi.

Download All
0 Kudos
Message 3 of 11
(2,608 Views)

Hello,

 

can you assist me in sorting the data in the attached text file:

Temp     Freq      Freq2   Volt

25.000 174.000 100.000 0.000
25.000 174.000 126.016 -0.010
25.000 174.000 158.013 -0.015
25.000 174.000 199.983 -0.026
-30.000 174.000 100.000 0.000
-30.000 174.000 126.016 -0.010
-30.000 174.000 158.013 -0.015
-30.000 174.000 199.983 -0.026
70.000 174.000 100.000 0.000
70.000 174.000 126.016 -0.010
70.000 174.000 158.013 -0.015
70.000 174.000 199.983 -0.026

 

so that I can have the three different temp plots (25, -30 and 70) of Freq2 vs Volt.

 

Thanks,

hiNi.

Download All
0 Kudos
Message 4 of 11
(2,596 Views)

It looks to me like that data is already sorted by temp, which is what you want.

 

Use array subset to split the freq2 array into 3 separate arrays (same for voltage using the same index/length values)

Then, bundle X & Y for a single plot into a cluster.  place all 3 clusters in a 1D array and wire to an XY graph (each cluster creates a single plot)

Message 5 of 11
(2,594 Views)

Could you show me an easier way if the amount of temp data is variable?

Download All
0 Kudos
Message 6 of 11
(2,589 Views)

Hello,

 

Just wanted to know if there is an easier way to extract the data if the temp data is variable?

 

Thanks,

hiNi.

0 Kudos
Message 7 of 11
(2,570 Views)

I'll take a look at it this weekend.  My method will likely involve nested loops which scan the 1D array for recurrances of the temp value, then move on.  Someone else might have a more elegent method.

Message 8 of 11
(2,568 Views)

THANK YOU for your time!

 

Sincerely,

hiNi.

0 Kudos
Message 9 of 11
(2,565 Views)
Solution
Accepted by topic author hiNI

This crude code will work for any number of temperatures and even allow for varying sizes of each array (say you measured 3 points at 1 temp and 6 points at another).  I highly doubt this is necessary but it's how the code works.

 

Just drop this in and connect the correct arrays loaded from you text file in place of the array controls i've used.  (or you can wire the terminals and use it as a sub-vi).

Message 10 of 11
(2,554 Views)