I am writting data from one file to another but not getting the expected data?
Show older comments
I have a data file called imu_data.bin, I am parsing that file and after parsing getting three outputs inertial_data,time_stamp and raw_data the size of inertial data is 24 bytes for one sample , time stamp is 4 bytes for one sample and for raw data is 28 bytes for one sample. I am trying to write the inertial data after parsing to another file for the purpose I am using the following code
My code is
filename = 'imu_data.bin';
[inertial_data,time_stamps,raw_data]=parse_imu_data(filename);
fid = fopen('test2.bin', 'w');
fwrite(fid, uint8(inertial_data), 'uint8'); % write data
fclose(fid);
As far as I concern after writting the code my output of the file test2.bin should be 24 bytes as I am writing only one sample but I am getting 8944 bytes. Let say it might be reading all the samples then the size of output file must contain nearly 35 thousand bytes as the total sample present in imu_data.bin is 1499.
I don't know why I am getting this pls help.
About my parsing file it is a pre existing file and the result after parsing are also correct and meeting the expected value.
2 Comments
Walter Roberson
on 30 Nov 2015
Could you confirm that size(intertial_data) is 24 ?
Please also experiment with
fwrite(fid, inertial_data)
as the default is uint8
Nikhil Singh
on 30 Nov 2015
Accepted Answer
More Answers (0)
Categories
Find more on Timing and presenting 2D and 3D stimuli in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!