Remove non-finite values while decimating
Mostrar comentarios más antiguos
I was able to decimate 8 other identical (or so I thought) files, but this one hit an error. Code and error below:
%% Set path
cd 'C:\folder'
%% Load data
data = readtable('data.csv');
%% Decimate and then convert to table format
data50_X = decimate(data{:,4},2);
Error using filtfilt
Expected input to be finite.
Error in filtfilt>efiltfilt (line 123)
validateattributes(x,{'double','single'},{'finite','nonempty'},'filtfilt');
Error in filtfilt (line 102)
y = efiltfilt(b,a,x);
Error in decimate (line 157)
odata = filtfilt(b,a,idata);
Respuesta aceptada
Más respuestas (1)
Likely, there are NaNs in your data that you have to remove.
find(~isfinite(data{:,4}))
5 comentarios
Taylor Azizeh
el 31 de Oct. de 2023
Taylor Azizeh
el 31 de Oct. de 2023
Matt J
el 1 de Nov. de 2023
find(~isfinite(data{:,4})) gives the locations of the bad data. You can go there and see what those values are, and either remove them or replace them with something else.
Taylor Azizeh
el 1 de Nov. de 2023
Categorías
Más información sobre Numeric Types en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

