Contains Clent and server modules, generating s-fucntion errors

5 visualizaciones (últimos 30 días)
Ying Fu
Ying Fu el 19 de Mzo. de 2025
Respondida: Kautuk Raj el 26 de Mzo. de 2025
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?

Respuestas (1)

Kautuk Raj
Kautuk Raj el 26 de Mzo. de 2025
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

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by