Hello. I'm having problems figuring out how to do this script: I have an excel file containing: Dates, Time, Value When I tried to read the excel file through Matlab, it changes the my 24hour time to decimal value. How do I keep it as 24 hour time values? I need to somehow match the date and sum up values within every 15 minutes Example: 12 10 9 13:01:00 0.01 12 10 9 22:36:52 0.01 12 10 9 22:40:27 0.01 12 10 9 22:42:41 0.01 12 10 9 22:45:37 0.01 12 10 9 22:47:25 0.01 12 10 9 22:51:12 0.01 12 10 9 22:54:25 0.01 12 10 9 22:58:04 0.01 12 10 9 23:01:38 0.01 So can anyone help me create a code to sum the 0.01 values for every 15 minutes and then combine the date that falls within the same time intervals? Thank you

0 |

7/6/2010 2:07:04 AM

Hello Thanks for responding. I couldn't figure it out before. I'm not quite sure how to go at it. So far I've only read the data. I'm not sure if I should read all the data first? Or one at a time (date, time, value) I'm having trouble getting started. I was thinking of doing a "for loop" and "if statements". I took a class before, about a year ago, but I totally forgot how to write codes ----------- clear all; clc; value = xlsread('Station_fire_tips_121009-061510-SF3', 'F2:F4098'); time = xlsread('Station_fire_tips_121009-061510-SF3', 'D2:D4098'); for i=1:4097 %number of rows end ------------ so far I only got that. so I need to read 4097 data. I just don't know where to start. i'm in desperate need of assistance. Thank you for your time.

0 |

7/6/2010 3:05:04 AM

help anyone?

0 |

7/6/2010 3:42:22 PM

On Jul 7, 3:42=A0am, "Andrew Liu" <nos...@gmail.com> wrote: > help anyone? Instead of sitting there waiting for others to solve YOUR problem, you should be trying to solve it yourself. It's pretty basic problem solving. It's not rocket science. What did you get when you executed those two xlsread commands? Do value and time have any data in them? If not, you need to read the help xlsread again and see what you have missed out. If they are not empty, what do the first few data look like? Are they sensible? If not, go back and read help xlsread again and see what you are doing wrong.

0 |

7/6/2010 7:58:54 PM

I'm not asking for anyone to solve my problem. I'm asking someone who can give me guidance and help. So far no one has provided any... anyways, this is my code ----- clear all; clc; % input data as = load('data.txt'); % the output file fid = fopen('dataout.txt','w'); %assign data date = as(:,1:3); ppt_data = as(:,end); time = as(:,4:6); k = 0; for i=1:length(time) if time(i,1:3) < [13 15 0] for ii = 1 k = k+1; sum(k,:) = sum(ppt_data(ii,:)); end elseif time(i,1:3) > [22 16 0] & time(1,i:3) < [22 60 0] for ii = 1 k = k+1; sum(k,:) = sum(ppt_data(ii,:)); end end end ------ So I have a list of time data which consists of 3 columns (each column corresponds to the hour, minutes, seconds, respectively). I'm trying to experiment with this data seeing if I can add values together that corresponds to the times (within 15 minutes of each other). Also, with the times, I have dates, that corresponds to the times. The times are set in 24 hours time frame.

0 |

7/6/2010 8:13:06 PM