Obtaning a matrix with the right indexes
Mostrar comentarios más antiguos
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.
2 comentarios
Nuno
el 17 de Abr. de 2013
Editada: Walter Roberson
el 18 de Abr. de 2013
Nuno
el 17 de Abr. de 2013
Respuesta aceptada
Más respuestas (1)
Ahmed A. Selman
el 18 de Abr. de 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)
1 comentario
Nuno
el 18 de Abr. de 2013
Categorías
Más información sobre Common Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!