Error when using "retime" function MATLAB 2024a.

4 views (last 30 days)
Ira
Ira on 11 Jul 2024
Answered: Walter Roberson on 12 Jul 2024
Hi everyone, I am needing to use the "retime" function on a large timetable data set. I need to retime the data in order to apply filters and process it in MATLAB. The timetable includes the timestamp column and the column of values at each time stamp (cannot post here because of proprietary information). I am trying to retime based on sample rate. Below is the code I am trying to run.
"INV1Spd", "INV1OutTrq", "INVCurrHV" are the timetables I am passing into the command.
"INV1Spd_Ts", "INV1OutTrq_Ts", "INVCurrHV_Ts" are the signal cycle times.
From Main Code:
[INV1Spd_Res, INV1OutTrq_Res, INV1CurrHV_Res] = resample(INV1Spd, INV1Spd_Ts, INV1OutTrq, INV1OutTrq_Ts, INV1CurrHV, INV1CurrHV_Ts);
From Function Script:
function [INVSpd_Resampled, INVOutTrq_Resampled, INVCurrHV_Resampled] = resample(INVSpd, INVSpd_Ts, INVOutTrq, INVOutTrq_Ts, INVCurrHV, INVCurrHV_Ts)
INVSpd_Resampled = retime(INVSpd, 'regular', 'linear', 'SampleRate', 1/INVSpd_Ts);
INVOutTrq_Resampled = retime(INVOutTrq, 'regular', 'linear', 'SampleRate', 1/INVOutTrq_Ts);
INVCurrHV_Resampled = retime(INVCurrHV, 'regular', 'linear', 'SampleRate', 1/INVCurrHV_Ts);
Error I get when running code:
Error using timetable/retime (line 142)
Interpolation failed for the variable 'INV1Spd' when synchronizing using 'linear':
Values V must be of type double or single.
I'm not sure what "Values V" is referencing. I've already tried different interpolation methods, I've converted the timetables to arrays (which expectedly threw another error), so I am unsure where to go from here. Please ask for any more information needed and I will try to provide. Thanks!

Answers (1)

Walter Roberson
Walter Roberson on 12 Jul 2024
One of the timetables contains a variable named INV1Spd but that variable is not type single or double.
You should check that the timetable named INV1Spd is not in fact a timetable containing a timetable variable named INV1Spd

Categories

Find more on Descriptive Statistics 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!