MATLAB Timeseries Resample Error: Quality vector must be initialized.

1 回表示 (過去 30 日間)
Ghazi Eltiti
Ghazi Eltiti 2018 年 10 月 12 日
コメント済み: Ghazi Eltiti 2018 年 10 月 14 日
Hi there, I am trying to resample a timeseries on MATLAB using the following code:
load RainData;
RKraut = RainData.Krautheim.data;
TKraut = RainData.Krautheim.time;
OldTS = timeseries(RKraut,TKraut);
NewT = ceil (TKraut(1)):1/1440:floor(TKraut(end));
NewRKraut = resample(OldTS,NewT,'interpmethod','zoh');
Krautheim.data = NewRKraut.data;
Krautheim.time = NewRKraut.time;
if I do not specify the interpolation method, everything works fine, but once I specify interpolation method as 'zoh', 'phcip' or 'linear' I get this error.
Error using timeseries/resample (line 65) Quality vector must be initialized.
Error in KrautheimRainResampling (line 6) NewRKraut = resample(OldTS,NewT,'interpmethod','zoh');
I am not even sure what is meant by 'Quality vector', I checked online and couldn't find any useful related subjects. I am using MATLAB R2018b. Any help would be highly appreciated.
Thanks in advance!

回答 (1 件)

jonas
jonas 2018 年 10 月 12 日
編集済み: jonas 2018 年 10 月 12 日
I suggest that you use a timetable and retime instead. I believe timetable offers more or less all the same utility as the timeseries function and more. Upload data if you need help adapting your code.
  3 件のコメント
jonas
jonas 2018 年 10 月 12 日
編集済み: jonas 2018 年 10 月 12 日
That's new to me, personally I've never had to use anything other than linear interp. I don't know what the problem is but I can take a look if you upload the data or a sample of the data for which the error is reproduced.
If I had to guess, then I'd make sure that all your old time-steps are unique. Could be that you mess up the vector when you round.
Ghazi Eltiti
Ghazi Eltiti 2018 年 10 月 14 日
The data are unique, and the function works if I do not specify the method of interpolation (linear interpolation by default), however, I get this error even if I specify the method as linear. There is no need to upload the data since I found a work around. But thanks for the offering to help.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by