フィルターのクリア

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

1 回表示 (過去 30 日間)
Nils Herjürgen
Nils Herjürgen 2018 年 8 月 3 日
編集済み: Nils Herjürgen 2018 年 8 月 3 日
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 件)

カテゴリ

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

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by