LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save plots from Agilent E4446A spectrum analyzer

Solved!
Go to solution

Hi everyone, I'm a newbie to LabView.  I'm now trying to store data (plots) from Agilent E4446A spectrum analyzer (SA).  I was modifying the example program (called Agilent ESA PSA Series Acquire Trace) from the VISA driver.  But I got stuck at the end of the program (I attached the pictures).  When the SA have the correct spectrum plot shown in the "Trace Waveform" window in the front panel, I don't know how to set the program up so that it stores the plot from the window screen into spreadsheet format automatically.  What I'm doing for now is to manually right click the trace waveform window and select "Export".  This is too slow to follow some fast changing results from the SA.  I was also trying to modify the output from "Trace Read" function in its driver library.  The output cluster (the pink line) consists of three data streams,  Initial X (double), X Increment (double), and Trace Array (1D array).  I can't connect this data cluster to "Write to Measurement File" vi anymore, this is pretty much the only saving method I worked with...  I really want to learn how to automatically save data in spreadsheet format out of the plot.

 

Thanks a lot for your help!

 

 

 

Trace Waveform Window.PNG                                                   Trace Read Function.PNG

Download All
0 Kudos
Message 1 of 18
(5,404 Views)

Well, you could simply unbundle the trace data and use the Write to Spreadsheet File VI. A simple solution would have been to use the Export Waveforms to Spreadsheet VI. However, you can't do this directly because the programmers decided to be, well, let's skip that word... and use a cluster instead of using the proper datatype, which would be the waveform datatype. Thus, if you wanted to use Export Waveforms to Spreadsheet you'd have to unbundle the cluster and then put the pieces back together again into a waveform datatype. Or, you could simply modify the driver VI so it outputs what it's supposed to output, and that is a waveform datatype.

0 Kudos
Message 2 of 18
(5,385 Views)

Hi Smercurio.  Thank you so much for your input!  I tried and realized that the Export Waveforms to Spreadsheet VI may not be the solution to me, because what I'm plotting and saving is not a wave, rather it is a spectrum plot (see the attached figure).  I was looking into the Write to Spreadsheet File VI.  It asks for arrays, and the output from the sample program contains only a 1D array for recording the amplitude of the spectrum.  As for the other information regarding the starting frequencies and spatial separation, they are all included in the cluster as two different integers (Initial X and X Increment).  So after I unbundled the cluster, I'm not sure how to feed them into Write to Spreadsheet File VI.

 

May you establish further?  Thank a lot!

 

amp.PNG

0 Kudos
Message 3 of 18
(5,376 Views)

You could simply prepend the start and delta to the array and write it out using the Write to Spreadsheet File VI. The first line would be the start, the next line is the delta, and the remaining lines are the values.

0 Kudos
Message 4 of 18
(5,367 Views)

@wyattmengy wrote:

Hi Smercurio.  Thank you so much for your input!  I tried and realized that the Export Waveforms to Spreadsheet VI may not be the solution to me, because what I'm plotting and saving is not a wave, rather it is a spectrum plot (see the attached figure).  I was looking into the Write to Spreadsheet File VI.  It asks for arrays, and the output from the sample program contains only a 1D array for recording the amplitude of the spectrum.  As for the other information regarding the starting frequencies and spatial separation, they are all included in the cluster as two different integers (Initial X and X Increment).  So after I unbundled the cluster, I'm not sure how to feed them into Write to Spreadsheet File VI.

 

May you establish further?  Thank a lot!

 

amp.PNG


It actually is very close to the waveform data type (your comment about a spectrum plot is nonsensical in this context) and using the Export Waveform to Spreadsheet is a very simple solution. One unbundle function wired to the Build Waveform function is all that you need. The cluster used for the spectrum output is just an older method that predates the waveform data type and it is what is shown for the Graph help.

0 Kudos
Message 5 of 18
(5,364 Views)

Hi semercurio.  Above all, thanks a lot for helping me!  I tried out design and it didn't work as I expect.  In order to reconstruct the plot in spreadsheet, I have to have two arrays of data for both x-axis and y-axis.  Because the "Trace Read" palate returns only 1 array plus the initial point and step size (they are both frequencies in this case), what I end up having in the saved spreadsheet was 2 numbers plus 1 array of data (the amplitudes).  Although theoretically I can plot it by forming the x-axis myself in excel (knowing the initial value and the step size), but because I'm going to collect a great amount of experiments, this is too tedious to do.

 

I just started learning LabView a few weeks ago, I'm still going through my infancy period on this program.  Thanks you sooo much for teaching me!

0 Kudos
Message 6 of 18
(5,352 Views)

Hi Dennis.  Oh man I think this method is gonna lead to something great!  While I was working on it today, I realized a problem.  As shown in the picture below, the output cluster doesn't have the corresponding "t0" asked by the Build Waveform function.  Within the cluster, the initial value (initial frequency in my case) is expressed by "Initial X", a double-precision floating-point number.  The Build Waveform function somehow insists on getting a time stamp for its "t0".  Is there a way to fix this?

 

build waveform.PNG

0 Kudos
Message 7 of 18
(5,348 Views)
One option is to simply skip the t0 input. It only shows up up in the optional header and you probably don't need it.
0 Kudos
Message 8 of 18
(5,343 Views)

It doesn't run without a valaid input as t0...

0 Kudos
Message 9 of 18
(5,341 Views)
Not sure what doesn't run but another easy option is to simply use the get current time function.
0 Kudos
Message 10 of 18
(5,337 Views)