Multiplying two columns from two excel sheets in MATLAB

1 Ansicht (letzte 30 Tage)
Kefayet Ullah
Kefayet Ullah am 20 Okt. 2020
Kommentiert: Ameer Hamza am 20 Okt. 2020
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

Antworten (1)

Ameer Hamza
Ameer Hamza am 20 Okt. 2020
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.

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by