[Simulink] Call the same Matlab function multiple times in a model
Mostrar comentarios más antiguos
Hi,
I have a generic Matlab function describing the behaviour of an battery electrode and I would like to call it in my model with various parameters (one call for the positive electrode, and the other call for the negative electrode calculation).
In order to make my function generic, I use a structure that contains parameters of the positive and negative electrode so that calling it with argument "pos" or "neg" will make the calculations with whether positive or negative parameters. Unfortunately, Simulink sees that as a "non constant parameter" and refuses to operate.
Do you have an idea of a way to call my "unique function" twice in my model: one call for the negative electrode and an other call for the positive one?
Thanks!
1 comentario
Clément E.
el 5 de Jul. de 2016
Respuestas (1)
Walter Roberson
el 4 de Jul. de 2016
0 votos
Use a Constant Block of signal type Boolean feeding into that parameter ?
Boolean because Simulink does not support signals that are type string.
https://www.mathworks.com/matlabcentral/newsreader/view_thread/45166
6 comentarios
Clément E.
el 4 de Jul. de 2016
Editada: Clément E.
el 4 de Jul. de 2016
Walter Roberson
el 4 de Jul. de 2016
parmnames = {'neg', 'pos'};
Rs.(parmnames{np}+1)
possibly?
Clément E.
el 5 de Jul. de 2016
Walter Roberson
el 5 de Jul. de 2016
Well then
if np == 0
params = Rs.neg;
else
params = Rs.pos;
end
Clément E.
el 5 de Jul. de 2016
Walter Roberson
el 5 de Jul. de 2016
Sorry I do not know about that.
Categorías
Más información sobre Simulink Functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!