Creating Timetables: Error Message in SampleRate

1 回表示 (過去 30 日間)
FW
FW 2019 年 4 月 18 日
コメント済み: Peter Perkins 2019 年 5 月 3 日
Hello, I am trying to use a suggested function to generate a timetable with a sampling frequency of 200 Hz.
tt = timetable(rand(12,1),'SampleRate', 200)
I get an error: Invalid parameter name: SampleRate. This is MATLAB 2017b.
How do we get the desired sample rate?
Thanks.
  1 件のコメント
idris
idris 2019 年 4 月 18 日
Can you please be explicit?

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

採用された回答

Adam Danz
Adam Danz 2019 年 4 月 18 日
編集済み: Adam Danz 2019 年 4 月 19 日
Here's a link to the 2017b documentation for timetable().
You'll see that there is no 'SampleRate' property. That property appeared first in r2018b.
Here's how to achive your example for releases before and after 2018b.
% 2018b or more recent
data = rand(12,1);
sampleRate = 200; %hz
tt = timetable(data,'SampleRate', sampleRate);
% prior to 2018b
timeSamples = seconds(0 : 1/sampleRate : (size(data)-1)/sampleRate);
tt = timetable(timeSamples', data);
  2 件のコメント
FW
FW 2019 年 4 月 19 日
Thank you. I will try to update to 2018b.
Peter Perkins
Peter Perkins 2019 年 5 月 3 日
Adam is right, but usually this
seconds((0:(size(data)-1))/sampleRate)
is better numerically.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by