LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting a XY Spectrum obtained from a spectrometer in LabVIEW using XY chart

Solved!
Go to solution

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

0 Kudos
Message 1 of 6
(3,919 Views)

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?

  • reading the datafile?
  • graphing the data?

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?

0 Kudos
Message 2 of 6
(3,911 Views)

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

0 Kudos
Message 3 of 6
(3,892 Views)
Solution
Accepted by topic author 555buddy

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

 

 

0 Kudos
Message 4 of 6
(3,882 Views)

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

0 Kudos
Message 5 of 6
(3,867 Views)

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! Smiley Happy

Download All
0 Kudos
Message 6 of 6
(3,744 Views)