From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save 1d array for use later

Solved!
Go to solution

Hi all,

 

I'm using a spectrometer VI that requires both a dark and light reference before processing. The spectrometer itself outputs a spectra in the form of a 1d array. In some rare occations, I cannot take new dark and light reference spectra due to sample issues and would like to use the last taken reference spectra (probably from the last time the VI was run).

 

Basically what I need to do is save the reference 1d array somewhere that can be called upon when the instrument is run again. I'm guessing, having it written to a file that can be read when called. What would be the best way to write a 1d array to a file so that it can be converted back to a 1d array as efficiently as possible?

 

Or is there a better way to do it that I'm missing?

 

Thanks

LV-2017
0 Kudos
Message 1 of 3
(1,954 Views)
Solution
Accepted by topic author Potticary

Hi Potticare,

 

What would be the best way to write a 1d array to a file so that it can be converted back to a 1d array as efficiently as possible?

WriteToBinaryFile to save the data, ReadFromBinaryFile to load the data later…

(You may use some other functions from the File functions palette, but they mostly add a layer of overhead.)

Best regards,
GerdW


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

The most efficient way would be to write it as a binary file, but the common way is to write it through Write delimited text file so it's human readable. Take your pick. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 3
(1,942 Views)