Question: how to convert this matlab code and use it?

i have two functions , first naive function has error after used.
 
if run FromMatlab, does it mean that do not need to copy the result and run again because it had already run?
as i do not understand the output code after translated.
 
there is syntax error when translate second function
 
with(Matlab):
FromMatlab("function X = sylv_naive(A,B,Q)
% X=SYLV_NAIVE(A,B,Q) solves the Sylvester equation AX + XB = Q
%    A, B, Q: matrix coefficients
%    X : solution of AX + XB = Q
[m,n] = size(Q);
H = kron(eye(n), A) + kron(B.', eye(m));
Qvec = reshape(Q,m*n,1);
Xvec = H\Qvec;
X = reshape(Xvec,m,n);
");
sylv_naive(Jesus7,Jesus7,Matrix([[0,0],[0,0]]));
sylv_naive(Jesus7,Jesus7,Matrix([[0],[0]]));
Error, (in ArrayTools:-Reshape) the desired output contains a different number of elements than the input
 
 
 
with(Matlab):
FromMatlab("function X = sylvester(A,B,Q)
% X=SYLVESTER(A,B,Q) solves the Sylvester equation AX + XB = Q
% by using the Bartels and Stewart algorithm based on the complex
% Schur decomposition
%    A, B, Q: matrix coefficients
%    X : solution of AX + XB = Q
[m,n] = size(Q);
[U,A1] = schur(A,'complex');
[V,B1] = schur(B.','complex');
Q1 = U'*Q*conj(V);
X = zeros(m,n);
X(:,n) = (A1 + B1(n,n)*eye(m))\Q1(:,n);
for i = n-1:-1:1
    v = Q1(:,i) - X(:,i+1:n)*B1(i,i+1:n).';
    X(:,i) = (A1 + B1(i,i)*eye(m))\v;
end
X = U*X*V.';");

Error, (in Matlab:-FromMatlab) on line 15, syntax error
    X(:,i) = (A1 + B1(i,i)*eye(m))
 
 
Please Wait...