How to generate a s-function which takes a string as input argument (before Matlab 2018)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!