Plotting results from to workspace block in simulink model

2 次查看(过去 30 天)
Plotting data from simulink using to workspace block and getting error in code.
below is an excerpt of the relevant code and the corresponding SIMULINK block diagram. I have provided the out.simX information including variable name below. The out.simU block follows the same structure. I am using version 2020b.
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)

采纳的回答

Johnathon Street
Johnathon Street 2021-7-25
t = ans.simX.Time;
u1 = ans.simU.Data(:,1);
u2 = ans.simU.Data(:,2);
u3 = ans.simU.Data(:,3);
u4 = ans.simU.Data(:,4);
u5 = ans.simU.Data(:,5);
x1 = ans.simX.Data(:,1);
x2 = ans.simX.Data(:,2);
x3 = ans.simX.Data(:,3);
x4 = ans.simX.Data(:,4);
x5 = ans.simX.Data(:,5);
x6 = ans.simX.Data(:,6);
Solved the issue for anyone who may be having the same trouble. After running the model it is saved as ans in the workbench so i modified the code accordingly. Probably a novice mistake but I am told the code has changed in the previous version or two so the tutorial I was following had me stumped. Anyhow, it works.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by