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.
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.
01-09-2014 01:10 AM
I need to plot a spectrum obtained from a spectrometer in LabVIEW using a XY chart. The data is stored in 2 columns of an excel sheet in the form of ( counts vs. wavelength ) & using 'read from excel.vi' ideally I should be able to plot that spectrum. The spectrum on average has 1k data points.
However, I am not able to obtain the graph using this method, please suggest a modification or provide me with a sample .vi as an example to understand.
Thanks in advance..!
Solved! Go to Solution.
01-09-2014 01:32 AM
If you have all data available you don't need an "XY chart" but a "XY graph". (charts are needed to incrementally add points to an existing display).
Where do you have problems?
Is the wavelength column linear (constant increment between points) or more random?
555buddy wrote:However, I am not able to obtain the graph using this method, ...
You don't explain at all what "this method" is. Can you show us your code and a typical data file so we can find out what you are doing wrong?
01-09-2014 02:19 AM
I am attaching an excel sheet that contains the spectral data and I need to plot the data ( A column vs. B column) using xy chart/graph as you suggested. The x column is non linear with random increments in the wavelength...
Thanks for helping..!
01-09-2014 02:43 AM - edited 01-09-2014 04:38 AM
excel is a proprietary binary format and you need special tools to read it directly. (There are plenty of ways to read it, here is one example, here is another one, but I tend to avoid these formats)
You could use excel to export the data as a plain text file (tab delimited) and then read is using ""read from spreadsheet file". Once you have the data in a 2D array, just graph the two columns. (See attached example)
Assuming you have read the file as a 2D array, here's how you would graph it. (For simplicity, I copied the data from excel to a string diagram constant).
01-09-2014 03:17 AM
Thanks a lot, that .vi worked good for me. I modified the code a bit as you suggested & will be using text files for further spectral plotting...!
01-13-2014 02:45 AM
Hi,
Now with the attached .vi I am able to read the data and dispay using xy graph. I need to detect the peaks in this spectrum with specific widths and above a certain threshold. I have used a specific peak detector. However, the locations and amplitudes displayed as results are vague and they do not correspond to the actual peak values. Is there any other method to detect the peaks efficiently, using slope method ? Let me know.
Thanks in advance!