O.K. I have almost what I want, but now matlab is giving me an error and I can't seem to go around it.
My program:
syms A1 A2 A3 A4;
N=20; %for example
A=sym(zeros(4,N));
B=sym(zeros(4,N));
H=sym(zeros(4,N));
A='A1A2A3A4'
B=1:1:N
C=mat2str(B)
%Concatenation
M=0;
s1=0:N-10
s2=1:N-9
for m=1:N
if m<10
H(1,m)=[A(1:2),C(2*m)];
H(2,m)=[A(3:4),C(2*m)];
H(3,m)=[A(5:6),C(2*m)];
H(4,m)=[A(7:8),C(2*m)];
end
if m>=10
for k=1:N
H(1,m)=[A(1:2),C(2*m+s1(k):2*m+s2(k))];
H(2,m)=[A(3:4),C(2*m+s1(k):2*m+s2(k))];
H(3,m)=[A(5:6),C(2*m+s1(k):2*m+s2(k))];
H(4,m)=[A(7:8),C(2*m+s1(k):2*m+s2(k))];
end
end
end
disp(H)
And the error:
Error using sym>convertExpression (line 2256)
Conversion to 'sym' returned the MuPAD error: Error: Unexpected 'integer'. [line 1, col 4]
Error in sym>convertChar (line 2167)
s = convertExpression(x);
Error in sym>convertCharWithOption (line 2150)
s = convertChar(x);
Error in sym>tomupad (line 1881)
S = convertCharWithOption(x,a);
Error in sym (line 108)
S.s = tomupad(x,'');
Error in sym/subsasgn (line 1614)
if ~isa(B,'sym'), B = sym(B); end
Error in la1 (line 27)
H(1,m)=[A(1:2),C(2*m+s1(k):2*m+s2(k))];