Azzera filtri
Azzera filtri

How to generate a s-function which takes a string as input argument (before Matlab 2018)

1 visualizzazione (ultimi 30 giorni)
Hi,
i want to have a s-function taking a string as input argument. Since i use Matlab 2017b and before Matlab 2018 strings are not a build-in Simulink type, i would like to know what is best practice for doing that. Until now i do the following:
def = legacy_code('initialize');
def.SFunctionName = 'testSFun';
def.OutputFcnSpec = 'test(double u1, uint8 p1[])';
So i use a uint8[] to pass the string to the function. In the corresponding c-file, in mdlRTW function i then use mxGetString. Unfortunately it does not work. If i type e.g. 'teststring' in the parameter field of the s-function block mask and then try to simulate, Simulink tells me
This parameter is an unsupported variable class such as a character vector, string, structure, cell, or an unsupported data type
What can i do?

Risposte (0)

Categorie

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

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by