Working on an excel file
이전 댓글 표시
Hello. I am a beginner in matlab and i have a problem trying to work out the average of a row of an excel file in matlab. i am able to read the file in matlab and when calculating average i have to do it per unit and student. Also assist in a program that can output each student's result.
attached is the excel file.
[~, ~, data1] = xlsread('C:\Users\RONNIE\Documents\EXCEL.xlsx','Sheet1','A1:G81');
%finding average of each unit and writing it to excel
units=xlsread('EXCEL.xlsx',1,'B2:G81')
avg=mean(units{:'B'})
L=sum(units,1)/80;
xlswrite('EXCEL.xlsx',L,1,'B82');
답변 (1개)
Don't use xlsread. Use readtable
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1071595/EXCEL.xlsx')
You can access the subject, you want using:
T.MATLAB % use coloumn name
T.(3) % use column number
댓글 수: 6
Jay vee
2022년 7월 20일
KSSV
2022년 7월 20일
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1071595/EXCEL.xlsx')
NAMES = T.(1) ;
AvgMarks = mean(table2array(T(:,2:end)),2) ;
Tavg = table(NAMES,AvgMarks)
Jay vee
2022년 7월 20일
KSSV
2022년 7월 20일
This you have to do.....
Jay vee
2022년 7월 20일
카테고리
도움말 센터 및 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!