Import spreadsheet, MATLAB calc, export spreadsheet

Import spreadsheet, MATLAB calc, export spreadsheet

Post by Jeff » Sat, 25 Mar 2006 03:59:51


I have an Excel spreadsheet with the following data:

A B A B

5 0.01500 5 0.01500
20 0.04000 15 0.03000
25 0.10000 22 0.10000
32 20.00000 27 20.00000
38 20.00000 35 20.00000
45 0.10000 43 0.10000
70 0.00300 70 0.00200
130 0.00300 90 0.00200
150 0.00010 100 0.03000
200 0.00010 110 0.03000
210 0.00400 150 0.00010
300 0.00400 190 0.00010
220 0.00150
300 0.00150

I am trying to import this data, separate the A's from B's into two
separate matricies. Then preform similar functions for the A's, then
the B's.

For the A's: Find the lowest and highest numbers in the matrix and
create an interval of 0.1 between these values (e.g. 5.0 5.1 5.2 5.3
... 299.8 299.9 300.0)

For the B's: Take the B value for each A value and find the B value
at each new created A value on a logarithmic scale.

I have been able to get this to work on a single A and B column. I
cannot get this to work for multiple A & B colums. Do I need to write
a loop to do this?

I would also like for the data computed in MATLAB to directly go to a
new excel file. Is this possible?

My code so far:

[DATA, HEADER]=xlsread('test.xls');
SIZE=size(DATA);

A=DATA(:,[1:2:SIZE(2)]);
B=DATA(:,[2:2:SIZE(2)]);

A_INTERVAL=[(min(A):.1:max(A))]';

B_INTERVAL=exp(interp1(log(A(:)), log(B(:)), log(A_INT),'linear'));

C=[A_INTERVAL B_INTERVAL]

I really appreciate any help.
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by Jeff » Sat, 25 Mar 2006 04:02:34

Should look more like this

A.B........A.. B

5 0.01500 5 0.01500
20 0.04000 15 0.03000
25 0.10000 22 0.10000
32 20.00000 27 20.00000
38 20.00000 35 20.00000
45 0.10000 43 0.10000
70 0.00300 70 0.00200
130 0.00300 90 0.00200
150 0.00010 100 0.03000
200 0.00010 110 0.03000
210 0.00400 150 0.00010
300 0.00400 190 0.00010
............220 0.00150
............300 0.00150

 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by Jeff » Sat, 25 Mar 2006 05:40:08

I CANNOT GET THIS TO WORK. DO I NEED TO WRITE A LOOP TO PREFORM THIS?
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by berniec » Sat, 25 Mar 2006 11:02:24

Why do you need two separate columns? Put them together.
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by Jone » Thu, 30 Mar 2006 03:33:28

Do I have to have Excel Link to do this?
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by jj » Thu, 30 Mar 2006 06:29:29

I do need to do this with multiple columns and output columns. Any
help?
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by Kiril » Thu, 30 Mar 2006 06:34:12

There are basically two ways of doing it: ODBC and ActiveX. For the
first one you need the database toolbox, and for the second you need
installation of Excel on your computer. Check
http://www.yqcomputer.com/
KA
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by JJ » Fri, 31 Mar 2006 04:21:30


I do not have the database toolbox. I do have excel. What
specifically should I be looking for from that link??
 
 
 

Import spreadsheet, MATLAB calc, export spreadsheet

Post by Dan Hae » Fri, 31 Mar 2006 19:19:09


For

I just did this at work, i read data from 10 time series, averaged
the correct columns row by row and put the averaged data into a new
excel file.

[data, colheaders] = xlsread(filename)
time=data(:,1);
data(:,1)=[];
N=[1:4:39];
ch1=data(:,N);
N=N+1;
ch2=data(:,N);
N=N+1;
ch3=data(:,N);
N=N+1;
ch4=data(:,N);
CH1 =mean(ch1,2);
CH2 =mean(ch2,2);
CH3 =mean(ch3,2);
CH4 =mean(ch4,2);
excel = horzcat(time,CH1,CH2,CH3,CH4);
xlswrite(newfilename, excel)