Multiplying two columns from two excel sheets in MATLAB
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!