Is it possible to program nested functions in a Simulink user-defined function?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lukas
am 18 Mai 2012
Kommentiert: Tien-Sang Nguyen
am 5 Jun. 2015
Hello
It is a question regarding the Simulink Toolbox.
Is it somehow possible to build up a nested function structure as following example shows in just ONE Simulink user-defined function? With consideration of using no “Interpreted MATLAB functions”-blocks, which are slowing down the simulation. Hence with use of just built-in blocks like the Matlab Function Block or a S-Function Block. It is important to me just to use blocks which are not slowing down my simulation.
Best greetings Lukas
Example:
function y0 = AnyUserDefinedSimulinkFunction(x0)
function y1 = func1(u1)
y1=func2(u1);
end
function y2 = func2(u2)
y2=2*u2;
end
y0=func1(x0)
end
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 18 Mai 2012
Nested functions are not supported for code-generation, so you can't use them inside a MATLAB Function block, but I think this should work with Level-2 MATLAB S-functions.
1 Kommentar
Tien-Sang Nguyen
am 5 Jun. 2015
Can you explain clearly for me the way to work with level-2 MATLAB S-function?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!