Custom excel formulas/functions in matlab
1 次查看(过去 30 天)
显示 更早的评论
I used other's matlab coding to generate data's of some tracked particles and I would like to calculate the mean square displacement. The following are the excel data sheet.
and I would like to use matlab for further handling the datas, in column K, I would like to input the excel formulas of =((H1)^2+(I1)^2+(J1)^2)/3 and loop til the end for each row respectively. and for column L, I would like to input the excel formulas of =max(column F). However, I am new to matlab and unable to write the code for the excel functions.
I understand that i need to use xlsread and xlswrite. So importing the excel file should be like this, right?
clear
dataset = xlsread("12.35mW-cm22_gray.xlsx",'5')
Then write code for the excel formulas.
Then use xlswrite to read a new excel file.
Could someone please help? I would appreciate your help a lot. Thank you.
0 个评论
采纳的回答
Amritesh
2022-7-15
You can import your .xls file in variable dataset, then make changes to it and finally export that in .xls file.
dataset = xlsread("12.35mW-cm22_gray.xlsx",'5')
for i=1:length(dataset)
dataset(i,11) = (dataset(i,8)^2 + dataset(i,9)^2 + dataset(i,10)^2)/3; % H -> 8, I -> 9, J ->10, K ->11
end
writetable(dataset,'modifiedDataset.xlsx');
Hope this solves your problem.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!