Borrar filtros
Borrar filtros

How can I use my function in a simulink block

1 visualización (últimos 30 días)
Lluis Ballber Mayans
Lluis Ballber Mayans el 1 de Ag. de 2019
Comentada: Lluis Ballber Mayans el 2 de Ag. de 2019
Hi,
Sorry in advance because I don't know how should be done so I can't show you any code/script. I have a huge Matlab project written and now I have to validate some function which are inside it using Simulink. These functions are .m files and I know which they are so my main idea was using each function as a block and run whatever I need but I think I can't because they are not in the same path as the simulink project and also they use functions like tf or c2d which are not suported. As a brief example, imagine that you have a function called integrator.m like this:
function y=integrator(u,Ts)
s=tf('s')
y=c2d(1/s,Ts)
end
Which is equal to the block if I'm not wrong...
Capture.PNG
And what I want is having a block which execute my function as follows:
Capture2.PNG
As I told you, this function is in a different folder from the simulink one. I know that the example is so silly but I think it simplifies well my problem without complicating with explanations about my real functions.
Thanks!
Lluis

Respuestas (1)

Gokul Prassad
Gokul Prassad el 1 de Ag. de 2019
You can try adding the functions in the same path as the Simulink model.
  1 comentario
Lluis Ballber Mayans
Lluis Ballber Mayans el 2 de Ag. de 2019
This is not an option since I told you that they are in a different paths but thank you anyway!

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Model Editing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by