C-MEX S-Functionで文字列をパラメータとして受け渡すことはできますか?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 17 Aug. 2012
Kommentiert: guygyuggfff
am 17 Jun. 2021
C-MEX S-Functionのパラメータに文字列を与えて、S-Function内部で文字列を使用する方法を教えてください。
Akzeptierte Antwort
MathWorks Support Team
am 17 Aug. 2012
ssGetSFcnParamで取得したmxArray構造体のデータからmxGetStringで文字列を取得することで、S-Function内で文字列として扱うことができます。
次のコマンドでパラメータを文字列として受け渡すC-MEX S-Functionのデモを起動できます。
sfcndemo_runtime
sfcndemo_sfun_rtwdwork
最初のデモではS-Functionブロックのパラメータ'++','SumTimesGain'等が文字列として渡されており、mxGetStringで文字列を取得しています。
2番目のデモはS-Functionがマスク化されていますが、「RTW Identifier」、「RTW Storage Class」、「RTW Type Qualifier」で入力(選択)された文字列が変数id, sc, tqとしてパラメータ入力されています。
注意点として、パラメータを使用したS-Functionを含むモデルからコード生成を行う場合、TLCファイルが必要になります。
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Author Blocks Using MATLAB S-Functions 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!