Read Excel and write output
1 次查看(过去 30 天)
显示 更早的评论
R = xlsread('Book1.xlsx') %% Excel sheet (Book1.xlsx) is in 'D' drive
A = 1; B = 2; C = 3;
Nu = A*p1 + B*p2 + C*p3;
I want Matlab to read Excel sheet, columns C, D, and E, then calculate Nu (column F) by the above formula and write the respective values in column F in that excel sheet automatically.
0 个评论
采纳的回答
Voss
2024-1-13
filename = 'Book1.xlsx'; % path to your file, e.g., 'D:\PK79\Book1.xlsx'
% read the file to a table:
T = readtable(filename)
% update the NU column:
A = 1; B = 2; C = 3;
T.NU = A*T.p1 + B*T.p2 + C*T.p3
% write the table back out to file:
writetable(T,filename,'WriteMode','overwritesheet')
% check the result:
T = readtable(filename)
更多回答(1 个)
Image Analyst
2024-1-13
What is p1, p2, and p3? You might try
R = xlsread('Book1.xlsx') %% Excel sheet (Book1.xlsx) is in 'D' drive
A = R(:, 1);
B = R(:, 2);
C = R(:, 3);
Nu = A*p1 + B*p2 + C*p3;
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!