hi all, I wanna do loop for an output to be like this
how can I get this output in MATLAB??? please help and advice...
No products are associated with this question.
ADD after Samer's answer
m=15; id = [6 16]; time1 = cellstr(datestr(datenum(0,0,0,12,m*(1:diff(id)+1),0),'HH:MM')); xlswrite('1.xlsx',time1,1,sprintf('A%d',id(1)));
Clock=char('12:00','12:15','12:30','12:45','13:00','13:15','13:30','13:45','14:00'); for i = 1:size(Clock,1) Clock(i,:) end
Does this help you
Try running this script... It has some ideas you might use, but it is hardly optimal.
startTimeString = '12:00'; stopTimeString = '14:00'; startTimeDV = datevec(startTimeString); stopTimeDV = datevec(stopTimeString); timeInterval = input('Enter the time step in minutes.\n');
thisTime = startTimeDV;
while thisTime(4) < stopTimeDV(4) % a hack to count +60 minutes as hour thisTime = datevec(datestr(thisTime)); thisTimeString = datestr(thisTime); disp(thisTimeString(end-7:end)) thisTime(5) = thisTime(5) + timeInterval; end
If you just want a loop with only 3 different intervals maybe this crude method can help Clock15=char('12:00','12:15','12:30','12:45','13:00','13:15','13:30','13:45','14:00'); Clock30=char('12:00','12:30','13:00','13:30','14:00'); Clock60=char('12:00','13:00','14:00'); based on gui if u use popup menu use switch case and give either of Clock15/Clock30/Clock60 to Clock and write a loop, for i = 1:size(Clock,1) Clock(i,:) end Does this help you
hi all, first I would like to thank you all for your cooperation and I really appreciate it, its all get the work, but the one I need it in my work is as follow:
mins=15; for i=6:16 %number of cell I want to write in. time= datestr(datenum(0,0,0,12,mins,0),'HH:MM'); range = sprintf('A%i', i); xlswrite('C:\Users\Samer\Desktop\Excel 1.xlsx',time,'Sheet1',range) mins=mins+15; end
but the problem that I face now is its right each digit in one cell, so how could I overcome this problem ??
your help really appreciated. thanks