Decimated table exporting same size as original

조회 수: 8 (최근 30일)
Taylor Azizeh
Taylor Azizeh 2023년 7월 17일
댓글: Taylor Azizeh 2023년 8월 21일
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
Stephen23
Stephen23 2023년 8월 21일
"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.
Taylor Azizeh
Taylor Azizeh 2023년 8월 21일
I would just assume that if you have half of the rows of data, logically, your file should be half the size.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by