How to extract data from simulink to work space in matlab?
조회 수: 19 (최근 30일)
이전 댓글 표시
I tried to design a LQR controller. I wrote the code and design a simulink model.
I wanted to extract data from simulink to workspace.
But when i run the code it says error in time which i have written as t= sim_X.time.
How can I solve the issue?
I have attached the screen shot below.
댓글 수: 2
Sugar Daddy
2020년 6월 1일
make sure it is sim_X.time or sim_X.Time or sim_X.tout. Visualize it in workspace
답변 (2개)
Ameer Hamza
2020년 6월 1일
Try "To workspace" block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/toworkspace.html
댓글 수: 2
Ameer Hamza
2020년 6월 2일
Have you selected "Timeseries" as save format inside the To workspace block?
khalid elamin
2021년 1월 12일
Try this:
simOut =sim('simulinkviayoutube')
t = simOut.sim_X.time;
x1 = simOut.sim_X.signals.values(:,1);
x2 = simOut.sim_X.signals.values(:,2);
it will help you !!
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!