how to get the last row of data of a time series when I dont know how many rows that time series has
12 ビュー (過去 30 日間)
古いコメントを表示
Morteza Ghafoori
2019 年 5 月 4 日
コメント済み: Morteza Ghafoori
2019 年 5 月 5 日
Hello, so I have a simulink model that gives me various variables and one of them is a time series. Let's suppose that the variable name is R and I want to get the last row of its data, I know that the data has 9 columns but the number of rows is unkown, any idea how to get that last row of data?
I've tried getdatasamples(R,end) but it doesn't work. Thanks for the help
0 件のコメント
採用された回答
Sulaymon Eshkabilov
2019 年 5 月 5 日
Hi,
Of course it is possible. Here are the answers step - by - step.
1) if you have an array saved under variable name R, then: >> R(end, :)
2) if you have one time series (signal) variable and your output variable in the workspace (e.g. it is called: Sout), then:
>> Sout.Data(end,:) % ==> would give you the last value of the collected signal from your simulink model.
3) If you have two time series signals saved under one variable name (e.g. Sout), then:
>> Sout.signal1.Data(end,:) %==> would give you the last value of the collected signal 1
>> Sout.signal2.Data(end,:) % ==> would give the last value from the signal 2
4) if you have saved your signals (e.g. one, two, three, four .... signals) as a structure variable with time series called STout, then:
>> STout.signals.values(end,:)
5) if you have saved your signals (e.g. one, tow, three, four, ... signals) as a structure variable called SSout, then
>> SSout.signals.values(end,:)
Good luck
その他の回答 (1 件)
Sulaymon Eshkabilov
2019 年 5 月 4 日
Let's say you have saved your variable R data into MATLAB workspace, then to get the last row of R, this is the command:
R(end, :)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!