Get or set parameters of objects
There are various ways to read/write or get/set the values of parameters of objects.
Option1 for objects within Simulink for example
Suppose a simulink model is saved under the name BlueBox_ClosedLoop.slx
% To find the parameters of the block 'PID Controller' in this Simulink model
get_param('BlueBox_ClosedLoop/PID Controller','DialogParameters')
% To get the current value of the parameter called 'P'
get_param('BlueBox_ClosedLoop/PID Controller','P')
% To set the value of an parameter use
set_param('BlueBox_ClosedLoop/PID Controller','P',num2str(Kp))
% NB: you have to use strings in this case to pass a numerical value
Option 2 for variables in the Matlab workspace
Suppose you have an variable called Proces denoting a transfer function of the type 1x1 tf
% To find the parameters of the transferfunction called Proces
get(Proces)
% To get the current value of the parameter called 'IOdelay'
get(Proces,'IODelay') % or use the command: Proces.IODelay
% To get the coefficients of the Numerator you have to change something, because
get(Proces,'Numerator') % or use the command: Proces.Numerator
% will give you a result looking something like: ans = [1x4 double]
% to access the actual coefficients do:
Proces.Numerator{1}
% In general use the construct: <Object>.<parameter>{<element number>}
% Set values for parameters goes like this
set (Proces,'IODelay',1) % or use the command: Proces.IODelay=1
% NB: Here numbers are used and not strings to transfer the values for numbers