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

rng('default');
C = pid(rand(2,3),rand(2,3));

% Extract all the coefficients from the array.

[Kp,Ki] = piddata(C);

% 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.

[Kp,Ki] = piddata(C,2,1)

% Copyright 2021 The MathWorks, Inc.