%% Extract Coefficients from 2-DOF PI Controller Array
% Typically, you obtain an array of controllers by using pidtune on an array of plant models. For this example, create an 2-by-3 array of 2-DOF PI controllers with random values of Kp, Ki, and b.

rng('default');
C2 = pid2(rand(2,3),rand(2,3),0,0,rand(2,3),0);

%
% Extract all the coefficients from the array.

[Kp,Ki,Kd,Tf,b,c] = piddata2(C2);

%
% Each of the outputs is itself a 2-by-3 array. For example, examine Ki.

Ki

%
% Extract only the coefficients of entry (2,1) in the array.

[Kp21,Ki21,Kd21,Tf21,b21,c21] = piddata2(C2,2,1);

%
% Each of these outputs is a scalar.

Ki21

% Copyright 2015 The MathWorks, Inc.