필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by