
simulink to workspace indexing error
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi, last week I was running the same simulink model and was receiving an array that was very large. This week I am trying to export data but the output is only a 1x1 double timeseries. I didn't change anything other than the data I am extracting so I'm not sure what could have changed in my simulink model. I have attached the file and here is the code I am using to extract data
When I run the code I get the error "Index in position 2 exceeds array bounds (must not exceed 1)."
RBE500_Week5_Model_barsoumian_tina
%defining variables to plot
EE = out.EE_Position_Velocity;
Position = EE(:,2:4);
LVelocity = EE(:,5:7);
AVelocity = EE(:,8:10);
댓글 수: 0
답변 (1개)
Sai Sri Pathuri
2020년 3월 5일
In your code, EE is a timeseries data with following properties
Common Properties:
Name: ''
Time: [51x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [51x9 double]
DataInfo: [1x1 tsdata.datametadata]
The variable has two fields - Time and Data as shown below

To extract data, you may use the dot indexing
Position = EE.Data(:,1:3);
LVelocity = EE.Data(:,4:6);
AVelocity = EE.Data(:,7:9);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!