MATLAB Answers

Simple question how do I adjust the for loop to go through the rows of the excel matrix one by one. Milesdriven adds the columns 2:11 of the first row, i want the calculation to be done for the next 54 rows as well.

조회 수: 1(최근 30일)
Khalid Tewfik
Khalid Tewfik 4 Dec 2016
filename = 'project3data.xlsx';
num = xlsread('project3data.xlsx');
for i = 1:55
milesdriven = sum(num(2,2:11))
end

답변(1개)

Tamir Suliman
Tamir Suliman 5 Dec 2016
filename = 'project3data.xlsx';
num = xlsread('project3data.xlsx');
for i = 1:55
for j =2:11
milesdriven = sum(num(i,j))
end
end

  댓글 수: 1

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by