Obtaning a matrix with the right indexes
이전 댓글 표시
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.
채택된 답변
추가 답변 (1개)
Ahmed A. Selman
2013년 4월 18일
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)
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!