Call script in setupImpl for initializing a Matlab System subclass

6 ビュー (過去 30 日間)
Bruno Morabito
Bruno Morabito 2018 年 3 月 20 日
コメント済み: Sahib Multani 2020 年 2 月 14 日
Hi all,
I have a script that should initialize a class that I want to use in Simulink using an (interpreted) Matlab System block. This script outputs a structure, e.g.:
struct = initializationScript;
The initialization should be done only once. I am aware that the method setupImpl should be used for initialization, but don't want to copy the content of the initialization script inside this method, since it is pretty large.
I tried to call the initializationScript script from the setupImpl, but I get the error:
Problem creating simulation targer MEX-file for model ... This text contains non-empty top-level expressions. It appears to be a script...
I wonder if there is a way to call initialization scripts in the setupImpl method.
Thanks!
Cheers,
Bruno

回答 (1 件)

Bruno Morabito
Bruno Morabito 2018 年 3 月 20 日
Hi,
I solved the problem. I actually forgot to set the block as interpreted. Then I set up the struct in properties (Access=private) and it worked.
  1 件のコメント
Sahib Multani
Sahib Multani 2020 年 2 月 14 日
Hi, I am facing similar issue. Cant work it out.
I have a matlab script that needs to be run. When it is run, it gives out 50 workspace variables. I needed to use these 50 variables and cant initialize this script in setupimp1. Any idea ?
Thanks

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by