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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multichannel waveform write to binary file

Hello all..
 
okay, right to the point, i have a problem saving an array of several waveforms acquired from may DAQ card. i save it every several hours using the elapsed time function (LabVIEW 8.2.1)
 
The loops look like this;
 
and i tried to read it with this vi:
 
Now., i can't figured out where i went wrong. Can somebody lend a hand?
 
Any help is much appreciated
 
 
Oh, btw, i've succesed save it into .wav file (using the example from Sound and Vibration Toolkit), but .wav can only have 2 channel right? is there a way so a .wav file can contain all of my 7 channel waveforms?
 
How about spreadsheet (excel) file?
Message 1 of 20
(5,247 Views)
opiq,

Try changing the "prepend array or string size" constant on the Write to Binary File from False to True.
The other option would be to change the data type constant on the read from an array of waveforms to just a waveform constant.  You would then need to specify the number of elements i the array to read by specifying a value for the count input (in you case you have 7 channels, so wire a 7 to the terminal).
0 Kudos
Message 2 of 20
(5,230 Views)
Thank you Devin_K!
 
works like a charm.
 
btw, i have another question. (people,, always ask for more don't they? haha)
 
i found an interesting function: export waveform to spreadsheet.vi
i  tried to use it to record my seven channel and successed. The text file can be read (by a word processor or microsoft excel).
 
Now, how can import back my array of waveform from the spreadsheet produced? (since i can't find the import waveform function)
 
thanks in advance
Message 3 of 20
(5,221 Views)
I was playing around with the waveform write files to see if I could answer this question.  I noticed an odd behavior.
 
When writing to an existing binary waveform file, the buttons on the dialog box are reversed than the dialog box that comes when writing to an existing text-based file.
 
I would say replace then cancel would be the natural order.  It looks like the way the buttons are named (and how they are programmed to act) is written differently in the two VI's down deep in the code where the two button dialog function is used.
 
Nothing that would be a bug, but just an inconsistent appearance that I stumbled upon while playing with these VI's.
 


Message Edited by Ravens Fan on 02-07-2008 10:49 PM
0 Kudos
Message 4 of 20
(5,213 Views)
To answer the question, I don't think there is a reverse operation available to go from text-based spreadsheet file to waveform.  Theoretically, you could write your own code to do that.  You'd have to parse out the text file and rebuild the components back into a waveform.  But considering the number of different variations that the text file could take (# of waveforms, time stamps, variants, single or multiple time columns) it would not be trivial.  While the binary file functions have that built in because they use some built in Labview functions that work convert clusters to binary files and back again.  (Datalog files)
0 Kudos
Message 5 of 20
(5,208 Views)
ow,, i see.. okay2.. i've give up the spreadsheet file and go with the lvm express vi, hahaha
 
thankyou all!
0 Kudos
Message 6 of 20
(5,205 Views)
Actually, the LVM Express VIs are the waveform to spreadsheet and spreadsheet to waveform VIs (assuming you are using the LVM format - TDMS is binary and should be a lot faster).  Read To and Write From Spreadsheet file also exist, but they assume simple arrays, so you would need to add the t0 and dt yourself, as Ravens Fan said.  For those who want more control, there is Spreadsheet String to Array and Array to Spreadsheet String in the strings palette.

Note:  The above presumes LabVIEW 8.2 or above.  Some elements may be missing or have different names for earlier versions.
0 Kudos
Message 7 of 20
(5,196 Views)
hoo,, nice info,, basically i just avoid using any express vi and tried to use a lower level vi,, but i've spend too much time in this issue. much appreciated!!
0 Kudos
Message 8 of 20
(5,191 Views)
Good catch on the inconsistent dialog boxes, Ravens Fan!  These dialog boxes are also not consistent with those used by the standard "Write to Binary File" and Write to Text File" functions.  I've gone ahead and filed this with R&D.
0 Kudos
Message 9 of 20
(5,180 Views)

Hi guys,

 

I read your messages.

 

 

So, how did you managed to write the 7 channels in a single wav file???

 

 

I'm trying to write 8 DAQmx channels into a single wav file. Please have a look at my posting: "How to log 8 DAQmx channels into a single wav file?"

 

 

Thanks a lot, Smiley Happy

Martin

0 Kudos
Message 10 of 20
(4,700 Views)