How to load a variable to simulink at the first model run only?

조회 수: 3 (최근 30일)
Amr
Amr 2023년 12월 15일
댓글: Amr 2023년 12월 15일
I have a large lookup table in Simulink. Each time I run the model, it took around two minutes in the compilation phase even the simulation itself is so fast. When I comment the table, the compilation phase is so fast. So, i guss it uploads the tabel data in that time.
i'm woundring if there is a way to upload this table data in simulink one time only at the beginnign and continue using it without re-uploading.

답변 (1개)

atharva
atharva 2023년 12월 15일
Hey Amr,
I understand that you want to to upload your table data in simulink one time only at the beginning and continue using it without re-uploading.
Yes, you can use the "From File" block in Simulink to load the lookup table data from a file at the beginning of the simulation. This way, the data will be loaded only once and can be used throughout the simulation without re-uploading. You can use the "MAT-file" option in the "From File" block to load the data from a .mat file.
You can go through the official mathworks documentation for better understanding
I hope this helps!
  댓글 수: 1
Amr
Amr 2023년 12월 15일
thanks for your answer.
actually using this block will need to upload the file each time the simulation starts.
I found something that solved it. By using the Fast Restart mode. In that case, the model is compiled only one time and as long as the structure is not changed, no need to do compilation again.

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

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by