name = getname(mpcobj,'input',i)
returns the name of the ith input signal of the plant model in
mpcobj. This is equivalent to name =
mpcobj.Model.Plant.InputName{i}.
name = getname(mpcobj,'output',i)
returns the name of the ith output signal in variable
name. This is equivalent to
name=mpcobj.Model.Plant.OutputName{i}.
Create a plant and an MPC object, and then retrieve the names of some
input and output signals.
mpcverbosity off; % turn off mpc messages% create plant model
plant = rss(4,4,4); % random state space
plant.D = 0; % set D matrix to zero% set signals type in plant model
plant = setmpcsignals(plant,'MV',1,'MD',3,'UD',4,'MO',1,'UO',[3 4]);
% create MPC object
mpcobj=mpc(plant,1); % sampling time = 1 second
Get names of input signals.
% get input signal names
getname(mpcobj,'input',1) % get name of first input signal
ans =
'MV1'
getname(mpcobj,'input',2) % get name of second input signal
ans =
'MV2'
getname(mpcobj,'input',3) % get name of third input signal
ans =
'MD1'
getname(mpcobj,'input',4) % get name of fourth input signal
ans =
'UD1'
Get names of output signals.
% get output signal names
getname(mpcobj,'output',1) % get name of first output signal
ans =
'MO1'
getname(mpcobj,'output',2) % get name of second output signal
ans =
'MO2'
getname(mpcobj,'output',3) % get name of third output signal
ans =
'UO1'
getname(mpcobj,'output',4) % get name of fourth output signal
ans =
'UO2'
% alternative ways to retrieve names
mpcobj.Model.Plant.InputName{2} % second plant input
ans =
'MV2'
mpcobj.ManipulatedVariables(2).Name % second manipulated variable
ans =
'MV2'
mpcobj.Model.Plant.InputName{4} % fourth plant input
ans =
'UD1'
mpcobj.DisturbanceVariables(2).Name % second disturbance variable
ans =
'UD1'
mpcobj.Model.Plant.OutputName{4} % fourth plant output
ans =
'UO2'
mpcobj.OutputVariables(4).Name % fourth plant variable name
ans =
'UO2'
Note that signals not specified with setmpcsignals are assumed to
be measured inputs (for non-specified inputs) or measured outputs (for non-specified
outputs).
This character array is the name of the ith input or output
signal (and it does not affect whether the signal is categorized as a manipulated
variable, measured or unmeasured disturbance, measured or unmeasured output).
For input signals, this is the content of
mpcobj.Model.Plant.InputName{i}, while for output signals, this is
the content of mpcobj.Model.Plant.OutputName{i}.
If the specified signal is a manipulated variable, this field is typically
'MV1', 'MV2', and so on, up to the number of
manipulated variables, unless specifically set otherwise. This is also identical to the
content of the Name field of the corresponding structure in
mpcobj.ManipulatedVariables.
If the specified signal is a disturbance input, this field is typically
'MD1', 'MD2', and so on, up to the number of
measured disturbance variables, or 'UD1', 'UD2',
and so on, up to the number of unmeasured disturbance variables, unless specifically set
otherwise. This is also the content of the corresponding Name field
of mpcobj.DisturbanceVariables.
If the specified signal is an output signal, this field is typically
'MO1', 'MO2', and so on, up to the number of
measured output variables, or 'UO1', 'UO2', and so
on, up to the number of unmeasured output variables, unless specifically set otherwise.
This is also the content of the corresponding Name field of
mpcobj.OutputVariables.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.