LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read labview 7.1 binary data into matlab 6.5?

I am having a similar issue with matlab 7 and labview 8.0.  The help on page http://digital.ni.com/public.nsf/websearch/2F8ED0F588E06BE1862565A90066E9BA?OpenDocument
and attached LV2Mat zip files seems like it might be dated.  I run it and  (once I get the permissions set right) get no errors but get something that seems to have only a 21 byte header.  The current version 5 mat-files have a 128 byte header.  When I fread it I can find my test data (1234) in it and have garbage in front and behind it.  Opening as a .mat file gives "error using ==> load.   File may be corrupt".  So I am thinking maybe it writes to the older mat-file formats that I can't find as much on.  I would be really clunky to try to convert everything to ASCII and recrunch it back.
I really want the simplest way to write to a binary file to 2 channels at 300 MS/s then have a mat-file to process the data.

I've been plowing through old threads and hope I haven't missed anything obvious.
0 Kudos
Message 11 of 14
(2,614 Views)
Hi cechafin,

at the moment you are writing your data (10 times DBL = 80 bytes) AND a header of 4 bytes (containing a U32 with number of elements, 0x0000000a) making a file of 84 bytes - thus making MatLab having problems to read correctly. Change your vi as attached to write only data without header.

Btw. "simplest way to write to a binary file to 2 channels at 300 MS/s":
2 channels at 300MS/s, writing as DBL makes 2*8*300=4800MB/s=4.7GB/s - what system do you want to use for writing at this datarate?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 12 of 14
(2,570 Views)
Thank you Gerd.  You are right.  I figured this out the hard way by counting bytes and randomly trying stuff but its nice to have it spelled out like that.  Since then I rewrote the program to get out of the DDT and just use an array.
This lets me load it and use it but it would still be nice to convert it straight into a .mat file from labview.
I am using 300 KS/s for each channel using a 6225 card.  The 300 MS/s  was a typo.  Not much sleeping sometimes.
Currently I just sent out to a binary file then after I take my run I convert it to a text file in the labview vi.  It is not graceful but is working.

I'm having trouble reading the vi you sent and many of the others because of "error 9", a different version of labview was used to write it.  I'm using 8.0 and I suspect there is a way around this.

Message Edited by cechafin on 05-31-2007 03:59 PM

0 Kudos
Message 13 of 14
(2,541 Views)
Hi cechafin,

so you learned the hard way: always note your LabView version when you like to have example vis!

I attached the example again, now as LV8... It's a pretty easy solution (more like a workaround), as I don't have much experience with LV8+ filefunctions.
Best regards,
GerdW


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