Removal of Unwanted Time Series Data from simout in Matlab Workspace

17 ビュー (過去 30 日間)
Andy Wileman
Andy Wileman 2022 年 2 月 19 日
回答済み: Andy Wileman 2022 年 2 月 20 日
Hi,
I wonder if anyone may be able to offer a solution. I would like to remove the first 0.1s from simout workspace data (see below). The simout data is a 1x1 double time series containing the columns Time and Data:1.
I have written the following code to try and remove the first 0.1 seconds (the transient).
tMin = seconds(0.1);
Vce = simout;
Vce = Vce(Vce.Time >= tMin,:);
Vce.Time = Vce.Time - Vce.Time(1);
Vce=Vce(Vce.Time >= 0.1);
However, I get the following error
The logical indices in position 1 contain a true value
outside of the array bounds.
Error in Healthy_Boost_Converter (line 3)
Vce = Vce(Vce.Time >= tMin,:);
I wondered if anyone might know what I'm doing wrong?
Kind regards,
Andy

採用された回答

Andy Wileman
Andy Wileman 2022 年 2 月 20 日
I have managed to come up with a solution, just in case anyone has this problem again.
Firstly, I enabled Single Simulation output in the Configuration Parameters in Simulink.
Secondly, I was then able to use the following
t = out.simout.time(out.simout.time >=0.1); % get time from out.simout where time >= 0.1
Vce = out.simout.data(out.simout.time>=0.1,1); % get data from data where time >= 0.1
plot(t,Vce)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by