Contains Clent and server modules, generating s-fucntion errors

1 回表示 (過去 30 日間)
Ying Fu
Ying Fu 2025 年 3 月 19 日
回答済み: Kautuk Raj 2025 年 3 月 26 日
I want to generate an s-function model from the model, but my model is a trige trigger, and there is a Clent and a server module in it, generating s-fucntion causes the following error:
Cannot generate S-Function for this subsystem because the subsystem contains one or more Simulink Function blocks. Caused by: Error while generating an S-function for 'PApro/Subsystem' in block diagram 'PApro'
How can I ensure that s-function is generated and I want to delete the server module?

回答 (1 件)

Kautuk Raj
Kautuk Raj 2025 年 3 月 26 日
I was also facing a similar error while working to generate a S-Function for a subsystem with client server interface during one of my workflows.
Could you confirm if there are multiple Simulink Function blocks called by the Function Caller blocks in your subsystem you are trying to generate S-Function for?
If yes, then as of MATLAB R2022b, S-Function generation is not supported if the subsystem contains one or many Simulink Functions.
A workaround for generating S-Function for a subsystem with Simulink Function(s) is to follow the steps below:
  • Replace the function caller with an empty atomic subsystem
  • Generate S-Function
  • Replace the empty subsystem's code with the code that calls the Simulink Function and finally
  • Re-mex the S-Function

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by