Decimated table exporting same size as original
5 views (last 30 days)
Show older comments
I am trying to decimate a data file that was recorded at 100Hz and the original size of the file is ~6.16GB. I decimated the data by a factor of 2 (to reduce the sample rate to 50Hz), which seems successful:
However, when exported, the size isn't even 1GB less than the original file:
Is my decimation working correctly? Code below.
%%%% Loop to decimate 3 columns (out of 17 total columns)
s = size(data_XYZ);
r = 2;
n = ceil(s(1)/r);
data_XYZ_50 = zeros(n,s(2));
for k = 1:s(2)
data_XYZ_50(:,k) = decimate(data_XYZ(:,k),r);
end
%%%% Extracing every other line from the columns.
data_50 = data(1:2:end,:);
%%%% Replacing the 3 original columns with the decimated data
data_50{:,3} = data_XYZ_50(:,1);
data_50{:,4} = data_XYZ_50(:,2);
data_50{:,5} = data_XYZ_50(:,3);
save_directory = 'G:\path';
table_path = fullfile(save_directory, 'table.csv');
writetable(data_50,table_path)
8 Comments
Stephen23
on 21 Aug 2023
"However, when I exported it as a CSV (this is the format I need), it is the same size."
A CSV file is just an uncompressed text file, why should it be any different?
"Are you saying that if my variable size in MATLAB looks decimated: 83745100/2 = 41872550, then it should be working?"
You could check it yourself: take the first few values, calculate by hand what you expect the "decimated" values to be.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!