access nth element from an array in simulink

조회 수: 28 (최근 30일)
Bhargav Jha
Bhargav Jha 2015년 8월 10일
댓글: Bhargav Jha 2015년 8월 11일
I have a 2D-array of positions imported from workspace. I want to increment the count to access the next element from array once a robot has reached this position. But I am unable to do so on simulink as the data that is imported is a timeseries and it continuously changes as simulation is progressing. Any help would be appreciated.
Thank you.

채택된 답변

Sebastian Castro
Sebastian Castro 2015년 8월 10일
Have you tried the Selector block ?
One of its configurations is that the selection index can be passed in via an input port. To do this, you change the Index Option (for the dimension you want) to Index vector (port) . This way, you can increment your counter outside and change the index as you need to.
- Sebastian
  댓글 수: 1
Bhargav Jha
Bhargav Jha 2015년 8월 11일
Thank you! I used index vector port to select data from a matrix. Secondly I also imported the matrix not as a timeseries but by putting the name of the matrix in constant block. This solved my problem.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by