# MATLAB- Manipulate excel data into Matlab

Discussion in 'Programmer's Corner' started by wilsonlee, Jul 22, 2014.

1. ### wilsonlee Thread Starter New Member

Jul 22, 2014
2
0
I'm currently working with short term load forecasting project.
I got my whole set of data in two columns( 1st column as the date with hour,min,sec and 2nd column as the load demand).
Now I'm having a problem in manipulating this data according to my input selection.

I wish to present my data as in

[ L(d,t) ........
L(d,t-1) ......
L(d,t-2).......
L(d+1,t)....... ]

L(d,t) = load at current hour of today
L(d,t-1) =load at 1hour ago of today
L(d+1,t) = load at current hour of tomorrow (which is also my output to be predicted)

I need to write a code to make my two columns data into what i wish to present as mentioned above. can anyone help? urgent and much appreciated.

2. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,968
616
MatLab has a feature to import data from other programs including Excel.

Each set of data in Excel must occupy one column. You time column in Excel has SIX sets of data (month, day, year, hours, minutes, seconds). This is your problem. Give each set its own column. Then import the data into MatLab.

You MatLab manipulation then becomes:
L(month, day, year, hour)=load at current hour of day you have selected
L(month, day, year, hour-1)=load at 1 hour ago of day you have selected

3. ### wilsonlee Thread Starter New Member

Jul 22, 2014
2
0
Thanks. But instead of that, I'm using the datenum function to convert the date vector into serial numbers already. doesnt it the same ?

4. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,968
616
Ok, sounds good.

Then what you need is array L that contains the loads. It will be two dimensional array, rows and columns. Use d values (dates) and h values (hours) as addresses of array L.