필터 지우기
필터 지우기

Multiplying two columns from two excel sheets in MATLAB

조회 수: 5 (최근 30일)
Kefayet Ullah
Kefayet Ullah 2020년 10월 20일
댓글: Ameer Hamza 2020년 10월 20일
Hello there,
I have two excel files. In both files, I have two coumns in each file. In one column the values are time values(x-axis) and the other column is my data(y-axis) at corresponding time values. This scenario is true for both the files. The time data range is same in both the coumns of both the excel files. Now I want to multiply the the data values (in y-asis) of both files with each other keeping the time range as it is. I mean, I just want to multuply the y-columns (or 2nd) column of both the excel files with each other.
It would be great if anyone could provide a MATLAB code for this operation. Any kind of help would be highly appreciated.
Thank you

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 10월 20일
If both files have same number of rows
data1 = readmatrix('file1.xlsx');
data2 = readmatrix('file2.xlsx');
out = data1(:,1).*data2(:,1);
If they have different number of rows then use interp1() first to make them equal.
  댓글 수: 2
Kefayet Ullah
Kefayet Ullah 2020년 10월 20일
Great. It worked.
Thank you
Ameer Hamza
Ameer Hamza 2020년 10월 20일
I am glad to be of help!!!

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by