need to find difference of two cells from one column in Excel
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
raghavendra kandukuri
am 22 Aug. 2018
Kommentiert: raghavendra kandukuri
am 22 Aug. 2018
Hi, I have an excel where column one(Time) has some values and column 5 (Duration), in duration i need to find the difference of 2nd element - 1st element from column one, i dont want to hard code that on excel, i want write that piece of code in .m file, how do i do it?
[num2, text, alldata2]=xlsread('exp2.xlsx');
temptime=num2(:,1); % getting column one from excel
holder=length(temptime); % getting to know how many elements are there in column one
i=1;
for i = 1:holder
duration()=(temptime(i)-temptime(i-1)); %its failing here
end
%% Excel is attached to this question
0 Kommentare
Akzeptierte Antwort
ahmed nebli
am 22 Aug. 2018
i think it should be done this way:
for i = 2:holder % the counter must get from 2 because temptime(i-1) would be error duration()=(temptime(i)-temptime(i-1)); %its failing here end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!