Custom excel formulas/functions in matlab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chun Fai Leung
le 15 Juil 2022
Commenté : Chun Fai Leung
le 15 Juil 2022
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 commentaires
Réponse acceptée
Amritesh
le 15 Juil 2022
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!