Unable to extract time and data from simout MATLAB

조회 수: 12 (최근 30일)
ISAAC HIEW
ISAAC HIEW 2023년 10월 14일
댓글: Eliza 2024년 4월 12일
Hi, I want to extract the time of a out.simout into a variable called "t". The following code works for MATLAB version 2018a but does not work for MATLAB version 2022a (the version that I am using). Moreover, I had referred to a similar question asked but it does not solve my problem. In the command window it says "Unable to resolve the name 'simX.Time'."
The following are my MATLAB code and an image showing my Simulink model::
t = simX.Time;
u1 = simU.Data(:,1);
u2 = simU.Data(:,2);
u3 = simU.Data(:,3);
u4 = simU.Data(:,4);
u5 = simU.Data(:,5);
x1 = simX.Data(:,1);
x2 = simX.Data(:,2);
x3 = simX.Data(:,3);
x4 = simX.Data(:,4);
x5 = simX.Data(:,5);
x6 = simX.Data(:,6);
x7 = simX.Data(:,7);
x8 = simX.Data(:,8);
x9 = simX.Data(:,9);

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 10월 20일
  1. As it indicates in the Simulink model, the data is saved in "out.simU". So, add "simX=out.simX;simU=out.simU;" in front of your code
  2. Or, Press Ctrl+E at your Simulink model, select "Data Import/Export" on the left column, uncheck "Single simulation output" option.

카테고리

Help CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by