SIMULINK block accessing its parameters dynamically

1 Ansicht (letzte 30 Tage)
John F
John F am 24 Nov. 2021
Bearbeitet: John F am 24 Nov. 2021
I'm creating a SIMULINK Library and I have made the following component:
And the function is:
function [m_out, Pt_out, Tt_out] = fcn(m_in, Pt_in, Tt_in)
coder.extrinsic('get_param')
PR = get_param('TURBO/Compressor Stage','PR');
%DT = get_param('TURBO/Compressor Stage','DT');
DT = 100;
disp(['PR is ',PR])
m_out = m_in;
Pt_out = 0;
Pt_out = PR * Pt_in;
Tt_out = 0;
Tt_out = Tt_in + DT;
end
I would like the function to be able to access the block properties dynamically. Meaning that I would like to replace 'TURBO/Compressor Stage' with '[dynamical name of model]/[dynamical name of block]' (or something equivalent).

Antworten (0)

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by