02-06-2015 04:52 PM
I'm trying to write to a binary file as a first step in understanding how the saved formats work.
Right now, I have two vi's, one writes a single double to a file, and the other writes a 1d array of doubles to a file.
When I read these files into MATLAB, observing the correct format, I successfully get my single double scalar back, but not the array of doubles. The array comes from 10000 samples of a sin waveform. I can observe that the output of the sine wave is correct via a waveform graph, and a waveform chart plugged into the Y values of the sine waveform.
I use the same commands in MATLAB for both:
fd = fopen('output.bin', 'r', 'b');
input = fread(fd, inf, 'double=>double');
fclose(fd);
Attached are the two variations of the vi.
Solved! Go to Solution.
02-06-2015 04:59 PM
By default LabVIEW writes the size of the array to the first few bytes of the file. I am not sure whether MATLAB interprets that size information. The Write to Binary File has an input to control the saving of the size information. Try a boolean False wired to "prepend array or string size?"
Lynn
02-06-2015 05:05 PM
Like a charm. I must have misread that as it defaults to false, thank you.