Obtaning a matrix with the right indexes
Show older comments
My question:
A want to obtain a matrix A(4xN)=[A11 A21 A31 A41; A12 A22 A32 A42; ...; A1N A2N A3N A4N].
So I think that I have to do something like this:
syms A1 A2 A3 A4;
N=10; %for example
A=sym(zeros(4,N));
B=sym(zeros(4,N));
for i=1:N
A(:,i)=[A1; A2; A3; A4]
end
for j=1:N
B(:,j)=[j; j; j; j]
end
C=char(A)
D=char(B)
%And now I have to do a concatenation:
E=strcat([C,D])
%But this won't work of course and I don't know if some part of my program is correct or there is a different approach for this.
Thank you for your atention.
Accepted Answer
More Answers (1)
Ahmed A. Selman
on 18 Apr 2013
Try this out to see if it solves the issue:
clear
clc
N=20; %for example
H=sym(zeros(N,4));
B=1:N;
%Concatenation
for j=1:4
for m=1:N
H(m,j)=['A',num2str(j),num2str(m)];
end
end
disp(H)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!