필터 지우기
필터 지우기

Read two matrices from CSV file then add them together

조회 수: 2 (최근 30일)
Ali Kareem
Ali Kareem 2015년 10월 28일
답변: Thorsten 2015년 10월 28일
Hi I read two matrices A=B=20*100 from CSV file then I try to add them together and I failed I used C=A+B and I use loop but it is not working I want to sum the same cell together i.e C(1,1)=A(1,1)+B(1,1), C(1,2)=A(1,2)+B(1,2) and so on. The problem I got is all the cell in matrix C is equal to (2)
any idea
Regards
  댓글 수: 2
Wanbin Song
Wanbin Song 2015년 10월 28일
You do not need to use loop for matrix sum.
Please explain more about your matrices, such as type, value, size.
Ali Kareem
Ali Kareem 2015년 10월 28일
편집: Ali Kareem 2015년 10월 28일
Hi,
Thank you for your reply
Size A=20*100
size of B=20*100
values of A and B (numbers)

댓글을 달려면 로그인하십시오.

답변 (1개)

Thorsten
Thorsten 2015년 10월 28일
You can read the matrices using dlmread. After you've done this, what is the size of A and B? It must be the same. Basically, it is as simple as
A = dlmread('yourfile1.csv');
B = dlmread('yourfile2.csv');
C = A + B;
If all values in C are 2, what are the values in A and B?

카테고리

Help CenterFile Exchange에서 Matrix and Vector Construction에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by