calculating each elements of matrixs
Show older comments
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 Comment
James Tursa
on 19 May 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.
Accepted Answer
More Answers (1)
tizh
on 20 May 2012
0 votes
Categories
Find more on Logical 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!