11-15-2011 07:12 PM - edited 11-15-2011 07:19 PM
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!
Solved! Go to Solution.
11-16-2011 08:22 AM
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.
11-16-2011 10:44 AM - edited 11-16-2011 10:44 AM
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!
11-16-2011 12:44 PM
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.
11-16-2011 12:53 PM
@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!
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.
11-16-2011 05:38 PM
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!
11-16-2011 06:45 PM - edited 11-16-2011 06:46 PM
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?
11-16-2011 08:52 PM
11-16-2011 09:17 PM
It doesn't run without a valaid input as t0...
11-16-2011 10:33 PM