Code covered by the BSD License  

Highlights from
Load Labview Binary Data

1.0

1.0 | 1 rating Rate this file 28 Downloads (last 30 days) File Size: 2.17 KB File ID: #27195

Load Labview Binary Data

by

 

08 Apr 2010 (Updated )

labviewload.m loads in binary data files output by Labview.

| Watch this File

File Information
Description

This script loads Labview binary data files into Matlab. I only tested double precision and boolean data files but I'm sure it'll work on any other numeric type given the appropriate precision input into the labviewload.m script. I tested it up to a three dimensional double array but there is no limitation in the code which limits it to only three dimensions.

It can load data files which have been repeatedly written to as long as each array is the same size. It's an extremely simple script (46 lines minus the help info) so it's easy to modify for more complex Labview binary files.

Example usage:
     D = labviewload('BinaryData.bin',3); % Load a binary file consisting of a three dimensional double array

    D = labviewload('BooleanData.bin',1,'int8'); % Load a binary file consisting of a one dimensional boolean array

Keep in mind that the second input is the NUMBER of dimensions of the array within the binary file and not the actual dimensions.

It outputs a cell array of arrays. For one and two dimensional arrays you can simply use cell2mat to convert it into an even more convenient format.

Tested on Matlab R2007a and Labview 8.2.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
11 Apr 2013 Felix

same problem here, on line 65, "Maximum variable size allowed by the program is exceeded."
When I try to skip this preallocation, I get other errors....
The binary file I try to load isn't even that big...

28 Feb 2011 Robert

I can confirm what Kevin says, I am getting the same error:

??? Error using ==> ones
Maximum variable size allowed by the program is exceeded.

Error in ==> labviewload at 65
data = repmat({NaN*ones(dims)},I,1); % Preallocate space, assumes each section is the same

Error in ==> data_processing at 7
data = labviewload('c:\110228103116StabTests.bin',8)

Please advice.

20 Feb 2011 Kevin Dean

Thanks for developing the script. Still having a hard time getting it to work on my labview data. Keep getting the following error:

>> D=labviewload('PeakAmplitudes.bin',2,'uint32');
??? Error using ==> ones
Maximum variable size allowed by the program is exceeded.

Error in ==> labviewload at 65
data = repmat({NaN*ones(dims)},I,1); % Preallocate space, assumes each section is the same

Thanks in advance...

13 Apr 2010 Jeremy Smith

Unfortunately fread cannot accept more than two dimensions so it will not work to use that method for data with higher dimensions.

12 Apr 2010 Jeremy Smith

Habit and ignorance. I wasn't aware fread could do that. I'll update the script next chance I get.

09 Apr 2010 Shaun

From the MatLab help:
A = fread(fileID, sizeA) reads sizeA elements into A and positions the file pointer after the last element read. sizeA can be an integer, or can have the form [m,n].

Why can't you accomplish this with one call to FREAD, then appropriate reshaping?

Updates
08 Apr 2010

- Improved description, no code change

06 May 2010

- ~13 times faster on a test file after adding preallocation
- Fixed reshaping

Contact us