Help me for solving this error

while ( true )

clear ; clc;
% clearvars (‘-except’ , keepVars {:} ) % used for loop testing

% generate system param
n=5; nu=4; ny=6; nd=1; nz=1; bny=2^ny ; % generate system parameters

% generate stable A matrix
M1=randn (n) ;
M2=randn (n) ;
M3=randn (n) ;
A=M3*(-M1’M1+(M2-M2’) ) /M3;
% generate marginally stable A matrix
M1_marg=randn (n-1) ; M2_marg=randn (n-1) ; M3_marg=randn (n-1) ;
T=randn (n) ;
A_marg=M3_marg
(-M1_marg’M1_marg+(M2_marg-M2_marg’)) /M3_marg ;
A_marg = [ A_marg , zeros(n-1 ,1) ; zeros( 1 , n) ] ;
A_marg = T\A_marg
T;
% generate unstable A matrix
M1_uns=randn (n-1) ; M2_uns=randn (n-1) ; M3_uns=randn (n-1) ;
T_uns=randn (n) ;
A_uns=M3_uns*(-M1_uns’M1_uns+(M2_uns-M2_uns’) ) /M3_uns ;
A_uns = [ A_uns , zeros(n-1 ,1) ; abs(randn( 1 , n) )] ;
A_uns = T_uns\A_uns
T_uns ;

A_mat=[A, A_marg , A_uns ] ;

% generateother system matrices
B=randn (n , nu) ;
C=randn (ny , n) ;
D=zeros ( n , n) ;

Cz=randn ( nz , n) ;
Bd=rand (n , n) ;
Dd=rand (ny , n) ;
%generate faults
Delta=faultsgen ( ny ) ;
% generate eigenvalue place holders
EigenValues=zeros (n , bny ) ;
EigenValuesNFTC=zeros (n , bny ) ; % no fault tolerant control
EigenValuesFTC=zeros (n , bny ) ; % with fault tolerant control
EigenValuesFFTC=zeros (n , bny ) ; % with fast fault tolerant control

%% Non fault tolerant control
cvx_begin sdp
cvx_precision high
variable Y(n , ny ) ;
variable P(n , n) symmetric ;
variable Gamma;
minimize (Gamma) ;
P>=eye (n) ;


 BRL=[P*A+A'*P+Y*C+C'*Y',P*Bd+Y*Dd,Cz';
 (P*Bd+Y*Dd)',-Gamma*eye(nd) ,D' ;
 Cz ,D,-Gamma*eye (nz) ]<=0 ;

cvx_end

L_NFTC=inv(P)*Y;
gamma_NFTC=Gamma;
cvx_NFTC=cvx_optval;

%% Fault tolerant control
cvx_begin sdp
cvx_precision high
variable Y(n , ny ) ;
variable P(n , n) symmetric ;
variable Gamma;
minimize (Gamma) ;
P>=eye (n) ;

for i =1:bny
% lypanouv stability
PA+YDelta ( : , : , i ) C+(PA+Y*Delta ( : , : , i ) *C)'<=0;
end

BRL=[PA+(PA)‘+YC+(YC)’ ,PBd+YDd,Cz’ ;
(PBd+YDd)',-Gammaeye(nd) ,D’ ;
Cz ,D,-Gamma
eye(nz) ] ;

BRL<=0;

cvx_end

L_FTC=inv (P)*Y % generate controller gain
gamma_FTC=Gamma
cvx_FTC=cvx_optval

%% Fast fault tolerant control
cvx_begin sdp
cvx_precision high
variable Y(n , ny ) ;
variable P(n , n) symmetric ;
variable S(ny , ny ) diagonal
variable Gamma;

minimize (Gamma) ;
P>=eye (n) ;

% lypanouv stability with relaxation
[PA+(PA)’ , Y+C’S’ ;
Y’+S
C,-S-S’]<=0;

BRL=[PA+A’P+YC+C’Y’ ,PBd+YDd,Cz’ ;
(PBd+YDd)',-Gammaeye (nd) ,D’ ;
Cz ,D,-Gamma
eye ( nz ) ] ;

BRL<=0;

cvx_end

L_FFTC=inv(P)*Y; % generate controller gain
gamma_FFTC=Gamma;
cvx_FFTC=cvx_optval ;

% check if all cvx has been solved-only move on until solved
cvx_check=[cvx_NFTC cvx_FTC cvx_FFTC ] ;
if ( isempty ( cvx_check ( isinf ( cvx_check ) ) )==1)
break ;
end

end

% testing controllers using simulation model
testScript ;
when i run this code,i show this error:
Error using cvx/cat
All dimensions but the one being concatenated (2) must be equal.

Error in cvx/horzcat (line 2)
y = cat( 2, varargin{:} );

Error in FaultTolerantLS (line 59)
(P*Bd+Y*Dd)',-Gamma*eye(nd) ,D' ;
please ,can you help me for solve this error

Use
whos
on all the items in the statement, and you will hopefully see what is non-conformal (incompatible dimensions). Note that CVX does not allow implicit expansion of CVX expressions, so you need to follow pre-MATLAB 2016b rules.

when i use whos ,i obtained these results:

whos
Name Size Bytes Class Attributes

A 5x5 200 double
A_marg 5x5 200 double
A_mat 5x15 600 double
A_uns 5x5 200 double
B 5x4 160 double
Bd 5x5 200 double
C 6x5 240 double
Cz 5x5 200 double
D 5x5 200 double
Dd 6x5 240 double
Delta 6x6x64 18432 double
EigenValues 5x64 2560 double
EigenValuesFFTC 5x64 2560 double
EigenValuesFTC 5x64 2560 double
EigenValuesNFTC 5x64 2560 double
Gamma 1x1 1241 cvx
M1 5x5 200 double
M1_marg 4x4 128 double
M1_uns 4x4 128 double
M2 5x5 200 double
M2_marg 4x4 128 double
M2_uns 4x4 128 double
M3 5x5 200 double
M3_marg 4x4 128 double
M3_uns 4x4 128 double
P 5x5 1817 cvx
T 5x5 200 double
T_uns 5x5 200 double
Y 5x6 1937 cvx
bny 1x1 8 double
cvx_problem 1x1 520 cvxprob
n 1x1 8 double
nd 1x1 8 double
nu 1x1 8 double
ny 1x1 8 double
nz 1x1 8 double
now you can show me where is the problem ,please

(P*Bd+Y*Dd)',-Gamma*eye(nd) ,D'
is
5 by 5, 1 by 1, 5 by 5
which is non-conformal, and not allowed in MATLAB.

Maybe you intended to have eye(n), which would make this
5 by 5, 5 by 5, 5 by 5