Custom excel formulas/functions in matlab
조회 수: 4 (최근 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!