How to access to data in the simulink in real time
조회 수: 32 (최근 30일)
이전 댓글 표시
Hi all,
When I run the simulink, I must wait until the end of the run to have acces to the data.
I want to access to the data at each iteration
Can you help ?
Thank you
댓글 수: 0
답변 (3개)
Sara Nadeau
2019년 7월 25일
Hi Mohamed,
Could you clarify what you mean by 'data at each iteration' and describe what you want to do with the data? Also, what release are you using?
If you'd like to view data during simulation, you likely have some options.
Sara
댓글 수: 0
Sara Nadeau
2019년 7월 26일
This doesn't exactly allow you access to your data in real-time, but you can use a Data Access callback function to access packets of data for a logged signal during the simulation. You write the code for the callback function in an m-file and then specify the function name and inputs the function expects in the Instrumentation Properties for the signal. After you mark a signal for logging, you can access the instrumentation properties by right-clicking the logging badge and selecting Properties.
You can use the same callback function for multiple signals, or specify a unique callback function for each logged signal.
For details, here is a simple example from the documentation: Access Data in a MATLAB Function During Simulation.
I hope this helps!
댓글 수: 1
Niklaus Lim
2020년 11월 9일
Hey Sara, I am using Matlab 2014a for my project. Do you have any other solution to solve the same issue for the older version of Matlab like Matlab 2014a?
참고 항목
카테고리
Help Center 및 File Exchange에서 Troubleshooting in Simulink Real-Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!