Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How do I link a pre defined function to the user defined function block?

1 visualización (últimos 30 días)
Alok Virkar
Alok Virkar el 28 de En. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Im using the user defined fucntion on matlab, but when I double click to open, it creates a new function. I dont want to write a new function, just simply link one I have already written.

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de En. de 2018
This is possible but it is not obvious. You can can set a property of the MATLAB Function Block if you happen to know just the right property name; you would need to set it to a string that contained the entire code of the function.
Alternatively you can unzip the model definition and edit the right XML file to insert the code, save, zip back up.
I do not happen to remember the correct property name at the moment. I have not done this much at all myself. I think I posted the property name about a year and a half ago, perhaps more, in response to a similar question. Unfortunately it is not as simple as just telling Simulink the name of a file to link to: Simulink embeds the code in the model.
... All of which implies that by far the easiest method is just to put in the appropriate function header and initialize the size and types of the return values, and then call out to your function.

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by