Undefined variable or class error
2 ビュー (過去 30 日間)
古いコメントを表示
The variable "NEWSST_2015" is not defined properly it seems, probably has to do with how time is indexed.. Could you please suggest how to index time here? The .mat file used is attached.
%% convert from daily to weekly (8-day) averages
load NEWSST_2015.mat
% Convert data into timetable
NEWSST_2015 = datetime(NEWSST_2015);
NEWSST_2015 = table2timetable(NEWSST_2015);
% Create time vector (8-day duration)
t = NEWSST_2015(1);
startTime = datetime(t.Year,t.Month,t.Day,t.Hour,0,0);
time = (startTime:days(8):NEWSST_2015(end))';
% Resampling
NEWSST_2015_2 = retime(NEWSST_2015,time,'linear');
0 件のコメント
採用された回答
Adam
2019 年 3 月 19 日
編集済み: Adam
2019 年 3 月 19 日
The variable in your mat file is called NEWSST, not NEWSST_2015.
It is usually better though to load a mat file into a struct and then reference from that e.g.
loadedData = load( 'NEWSST_2015.mat' );
NEWSST_2015 = loadedData.NEWSST;
then you will have a variable of the name you use. I haven't checked if the rest of your code is fine, but the variable not existing is certainly the main problem.
3 件のコメント
Adam
2019 年 3 月 19 日
I don't use datetime, but the error message seems very clear in what it expects. You give it a 3-dimensional array which does not conform in any way to those expectations.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!