131072 Loading a binary file in which data is stored.
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I saved 131072 data in a binary file in LabVIEW.
The data was saved in 16 bit, so the file size is 262 kB.
The sine wave data was saved and the file contains numbers between 0 and 2.3. I tried to make my own program, but I could not check the values between 0 and 2.3.
I would appreciate any advice you can give me.
0 comentarios
Respuestas (1)
Cris LaPierre
el 5 de Jun. de 2025
Editada: Cris LaPierre
el 5 de Jun. de 2025
Not sure what settings you used to record the data, but I only see values of 0, 1 and 2. If you are using an analog-to-digital converter, the quantization step size appears to be limiting what values can be captured.
Here's the code I uesd to read your file. I also plotted the first 1000 points.
% Specify the filename
unzip('Binary_000.zip');
filename = 'Binary_000.bin';
% Open the binary file for reading
fileID = fopen(filename, 'rb','ieee-be');
% We know the number of points, so use this to figure out the size of the
% header. Then skip the header
fseek(fileID,0,1);
p = ftell(fileID);
sk = p - 2*131072
fseek(fileID,sk,-1);
% Read the data as 16-bit floating point numbers
data = fread(fileID, 'int16',0 );
% Close the file
fclose(fileID);
plot(data(1:1000))
2 comentarios
Cris LaPierre
el 9 de Jun. de 2025
The "To Word integer" function in LabView converts a number to a 16-bit signed integer. So yes, this explains why the file only contains integer values.
Ver también
Categorías
Más información sobre Low-Level File I/O en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!