Auto-run Model named m-file

5 ビュー (過去 30 日間)
Pekka Hautamäki
Pekka Hautamäki 2017 年 5 月 16 日
コメント済み: shahid rasheed 2018 年 6 月 3 日
Hello!
I would like to auto-run m-file when I open Simulink model and this is something what you can do using callbacks. but... I would like to run m-file which one has same name with Simulink model when I open it.
Because in case that I have Simulink Model which one includes FPGA design, so this means that I need one m-file that I can do synthesis but after synthesis most of variable are useless and I would like to use second m-file when I integrate this model to the our system. Model has been renamed after synthesis "model_name" vs. "gm_model_name_slrt".
So is there any solution how I can auto-run m-file which one has same name as Simulink Model when I open it...?

回答 (1 件)

Ed Marquez
Ed Marquez 2017 年 5 月 19 日
Hi,
You can use another script to run the script and open the model (you can determine the order). For instance, if you have a script called modeNameHere.m and a Simulink model called modelNameHere.slx, then you could write another simple script as follows:
open_system('modelNameHere') % opens the model
run('modelNameHere') % call the script after opening the model
You can also run a MATLAB-file during simulation (as if it were one of the blocks) using the Interpreted MATLAB Function.
http://www.mathworks.com/help/simulink/slref/matlabfunction.html
  1 件のコメント
shahid rasheed
shahid rasheed 2018 年 6 月 3 日
Thank you so much, simple solution is very much appreciated every time.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVerification, Validation, and Test についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by