Simulink to workspace doesn't work
조회 수: 74 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1552397/image.png)
My Simulink file was like that and when i want to plot the results it doesnt work
%file is untitled2.m
Mp =10;
Mj=60;
Bp = 100;
Bj = 10;
KR = 400;
sim('parachute')
subplot(4,1,1)
plot(out.Time,out.xj,out.Time,out.xp,'--')
subplot(4,1,2)
plot(out.Time,out.vj,out.Time,out.vp,'--')
subplot(4,1,3)
plot(out.Time,out.aj)
subplot(4,1,4)
plot(out.Time,out.delx)
Output workspace is like that:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1552402/image.png)
How can i fix that? Thanks.
댓글 수: 0
채택된 답변
madhan ravi
2023년 11월 26일
Double click To workspace block. Select the "Save Format" as Array.
By the way, the one you have is timeseries.
You can simply plot by doing:
plot(out.vj) % for example , you don’t need to mention time as it’s understood it has time data within as it’s timeseries
댓글 수: 2
madhan ravi
2023년 11월 26일
편집: madhan ravi
2023년 11월 26일
Time is already integrated in timeseries. The above command is similar to doing
plot(out.vj.Time, out.vj.Data)
% when out.vj data format is Timeseries , that"s the advantage of Timeseries
When you have time, please have a look at Simulink Data Inspector. It is helpful in visualising signal without having to import to MATLAB and plotting it again just only by logging signals in Simulink.
추가 답변 (1개)
Walter Roberson
2023년 11월 26일
Turn off Single Simulation Output; https://www.mathworks.com/help/simulink/gui/singlesimulationoutput.html
댓글 수: 3
Walter Roberson
2023년 11월 26일
What gets stored at the MATLAB level is likely going to be a time series .
참고 항목
카테고리
Help Center 및 File Exchange에서 Time Series Events에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!