我是Matlab的新手,试图将加速度计信号的功能窗口化为txt文件。但是我收到了错误的数据,无法查看我的代码中的错误。如果有人能为我发现错误,我将不胜感激。
%WindowParams
Fq = 51.2;
%Sample Rate of Shimmer
windowLength = 15;
%Length for each window in seconds
startPos = 1;
startPos2 = 1;
startPos3 = 1;
%Starting Position for 1st win
endPos = startPos + (windowLength * floor(Fq));
endPos2 = startPos + (windowLength * floor(Fq));
endPos3= startPos + (windowLength * floor(Fq));
%End Position for 1st win
totalWindows = floor(length(martySit)/Fq/windowLength);
totalWindows2 = floor(length(martyJump)/Fq/windowLength);
totalWindows3 = floor(length(martyRun)/Fq/windowLength);
stats = zeros(windowLength,9);
for i = 1:totalWindows
epMean = mean(martySit(startPos:endPos,:));
%calculate window mean
%X, Y & Z axis values for each stat
martySitfeatures (i,2:5) = epMean;
%Next window position
startPos = endPos+1;
endPos = startPos + (windowLength * floor(Fq));
martySitfeatures (:,5) = 1;
end
for i = 1:totalWindows2
epMean = mean(martyJump(startPos2:endPos2,:));
%calculate window mean
%X, Y & Z axis values for each stat
martyJumpfeatures (i,2:5) = epMean;
%Next window position
startPos2 = endPos2+1;
endPos2 = startPos2 + (windowLength * floor(Fq));
martyJumpfeatures (:,5) = 2;
end
for i = 1:totalWindows3
epMean = mean(martyRun(startPos3:endPos3,:));
%calculate window mean
%X, Y & Z axis values for each stat
martyRunfeatures (i,2:5) = epMean;
%Next window position
startPos3 = endPos3+1;
endPos3 = startPos3 + (windowLength * floor(Fq));
martyRunfeatures (:,5) = 3;
end
当我将它们保存到我认为不对的文件时,结果如下所示
0.0000000e+00 8.0683900e+03 -5.2872114e-01 -4.4968032e+00 1.0000000e+00
0.0000000e+00 8.0879213e+03 -5.2027124e-01 -4.4780305e+00 1.0000000e+00
0.0000000e+00 1.3087921e+04 -5.7103067e-01 -4.5288128e+00 1.0000000e+00
0.0000000e+00 4.0041046e+04 8.8934563e+00 8.1063856e-01 2.0000000e+00
0.0000000e+00 2.4044953e+04 9.4689311e+00 9.0349316e-01 3.0000000e+00