calculating each elements of matrixs
Afficher commentaires plus anciens
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 commentaire
James Tursa
le 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.
Réponse acceptée
Plus de réponses (1)
tizh
le 20 Mai 2012
0 votes
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!