Creating Timetables: Error Message in SampleRate
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
채택된 답변
Adam Danz
2019년 4월 18일
편집: Adam Danz
2019년 4월 19일
Here's a link to the 2017b documentation for timetable().
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
Peter Perkins
2019년 5월 3일
Adam is right, but usually this
seconds((0:(size(data)-1))/sampleRate)
is better numerically.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!