Is it possible to place a level-2 S-function inside a package?

2 visualizzazioni (ultimi 30 giorni)
I am wondering if it is possible to create a level-2 MATLAB S-function where the "S-function name" field on the "Block Parameters" dialog references a level-2 MATLAB S-function that resides in a package. For example, I would like to specify "pkg1.pkg2.MySfun" in the name field where "+pkg1\+pk2\MySfun.m" is the pathname, relative to MATLAB's current working directory, of the script file for my level-2 MATLAB S-function.
I have a very large amount of legacy MATLAB code, organized nicely into packages, that I now need to turn into Simulink level-2 S-functions. My plan is to create a MATLAB script file for each major MATLAB function, in the same directory/package as the legacy function, that contains the necessary black callbacks and invokes the existing function. Basically, I'm trying to place the blocks into the same package hierarchy as the existing functions. However, when I tried this, Simulink was unable to find the block callback file in the package directory. I can invoke the function from the command line with the fully qualified package path to the function, so this seems to be a problem with Simulink and not MATLAB as a whole.
I'm using MATLAB R2018a.

Risposte (0)

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by