LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

spread sheet file to the formula loop

Solved!
Go to solution

I have a spectrum data wavelength vs intensity ranging from 600-800 nm, now i have to convert wavelength (x-axis) to wavenumber - i should get a wave number vs intensity output. I did the following code, But I see only first value is converted to wavenumber. Can anyone give me some suggestions to improve code.

0 Kudos
Message 1 of 22
(1,348 Views)

Hi KK,

 


@KK54321 wrote:

Can anyone give me some suggestions to improve code.


Use the AutoCleanup button to improve your code in the first step.

 

Then start to think about the algorithm you want to implement - and explain that algorithm to us so we can provide suggestions!

 

Right now I see:

  • You read an array from your file and pick the first element of that array.
  • Then you build an array from that single element, just to pick the first element again… (???)
  • Using that element to run a FOR loop x times.
  • Executing the same code in the loop x times, but only using the result of the last iteration. What's the point here?
  • That last scalar result is again build into an array (of just one element), then that array is sorted: what's the point in this operation???
  • Then the sorted array of float values is shown in an integer indicator: are you sure you display the expected values?
  • Why do you need a formula node for this small math formula? Why not use plain G functions?

@KK54321 wrote:

I have a spectrum data wavelength vs intensity ranging from 600-800 nm, now i have to convert wavelength (x-axis) to wavenumber - i should get a wave number vs intensity output.


Please explain the term "wavenumber"!

How do you want to convert wavelength to "wavenumber"? Which algorithm is used for that conversion?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 22
(1,327 Views)

Hi,

Thank you for your reply,

I created a below VI, which is now doing the following,

1. load the data from txt file (wavelength vs intensity data) and plot it in graph

2. converting the x-axis to wavenumber using Raman shift equation in formula loop

3. plotting wave number vs intensity in a graph and saving the data to a txt file. I feel this is working according to my plan. Bu I have a question  - I used for loop for formula loop but i did not use any iteration and give any command to n, but it still working.

 

So now I need to take the FFT of a wavenumber data which i got now and multiply it with Hann window and take IFFT - to get a clean spectrum.

Any suggestions will be highly appreciated. Attached the images for the above code.

Download All
0 Kudos
Message 3 of 22
(1,312 Views)

Hi KK,

 


@KK54321 wrote:

Any suggestions will be highly appreciated. Attached the images for the above code.


As you only attach images of code I will do the same:

No FOR loop needed!

 

Do yourself (and us) a favor and post real code next time! We cannot edit/debug/run images with LabVIEW…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 22
(1,289 Views)

Hi,

Thank you for you help, I have implemented your suggestion. Now I am using this generated wave number vs intensity spectra to do the following steps,

wave number vs intensity spectrum

  I

FFT

  I

multiply with Hann window 

  I

IFFT

  I

final spectrum in waveform graph

Below I attached the VI, I could not see any output spectra after IFFT. maybe I made some mistake in the code, if possible could you help me with this.; I have attacked data file (wavelength vs Intensity) also.

 

Thank you

KK

 

0 Kudos
Message 5 of 22
(1,264 Views)

Hi KK,

 

please downconvert your VI to LV2021 or (even better) LV2019. (File->Save for previous)

Many long-time users of LabVIEW didn't upgrade to LV2022/LV2023 yet due to subscription license issues…

 

(Did you notice my signature line?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 22
(1,259 Views)

Hi GerdW,

Please see the attached down converted VI. please let me know if this is working or any modifications are needed.

 

Thank you

KK

 

0 Kudos
Message 7 of 22
(1,255 Views)

Hi KK,

 


@KK54321 wrote:

Please see the attached down converted VI. please let me know if this is working or any modifications are needed.


Now I'm missing your datafile…

 

Why do you need that sequence structure?

Why do you use those PtByPt-FFT functions? Do you know what PtByPt-functions are good for?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 22
(1,243 Views)

Hi GerdW,

Please find the attached data file.first column is wavelength and second column is intensity.

 

Why do you need that sequence structure?

Why do you use those PtByPt-FFT functions? Do you know what PtByPt-functions are good for?

 

sorry about that, I am new to Labview, so using google and following previous Labview projects I made this code. Your suggestions are really help full.

 

Thank you

KK

0 Kudos
Message 9 of 22
(1,239 Views)

Hi KK,

 

see this:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 22
(1,220 Views)