calculating each elements of matrixs
Ältere Kommentare anzeigen
Hi all I am a highschool student studying matlab
What i want is to prgramming C matrix if matrix A (nx2), matrix B (nx2)
C(1,:)=A(1,:)-B(1,:)
C(2,:)=A(2,:)-B(1,:)
C(3,:)=A(3,:)-B(1,:)
C(4,:)=A(4,:)-B(1,:)
:
:
C(n,:)=A(n,:)-B(1,:)
C(n+1,:)=A(n,:)-B(2,:)
C(n+2,:)=A(n,:)-B(2,:)
C(n+3,:)=A(n,:)-B(2,:)
C(N+4,:)=A(n,:)-B(2,:)
:
:
C(n*n,:)=A(n,:)-B(n,:)
I ve tried like
I=1;
J=1;
K=1;
C(I,:) = A(J,:)-B(K,:);
for J = J+1
K = K+1
I = I+1
end
But failed, I hope some of you might help me
1 Kommentar
James Tursa
am 19 Mai 2012
Cross-posted on newsgroup. Looks like the last A(n,:) part is a repeated typo to me and should be
C(n+1,:)=A(1,:)-B(2,:)
C(n+2,:)=A(2,:)-B(2,:)
C(n+3,:)=A(3,:)-B(2,:)
etc.
Akzeptierte Antwort
Weitere Antworten (1)
tizh
am 20 Mai 2012
0 Stimmen
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!