| Discussion: | Research Area |
| Topic: | optimization Matlab |
| Post a new topic to the Research Area Discussion discussion |
| ||||||||
| Subject: | RE: optimization Matlab |
| Author: | Si |
| Date: | Aug 12 2004 |
How could I call
> Excel Data from a Matlab programm? I would be very grateful if
> somebody could send to me an example of Matlab Code to afford it.
First search the internet, there are some FREE GENETIC MatLab toolboxes (codes)
available.
Second, try typing on the MatLab command prompt the following statement:
help xlsread
That will give you of how to read Excel from MatLab , which gives the following
, which the MatLab codes is pretty much shown after typing the above help
command:
Cheers,
Sione.
----------------------------------------
----------------------------
XLSREAD read Excel spreadsheet (XLS) file.
A = XLSREAD('FILENAME') returns in A, numeric data from the first sheet
in
the Excel file FILENAME.
[A, B] = XLSREAD('FILENAME') returns numeric data, stored in A, and text
data, stored in B.
[...] = XLSREAD('FILENAME','SHEETNAME') is the same as above but uses the
sheet named SHEETNAME. XLSREAD throws an error if SHEETNAME does not
exist.
Empty cells or cells with text result in NaN elements in the returned
numeric
data.
Leading rows and columns of text do not create NaN elements in the
numeric
result. This makes it easier to load files that look like this:
Time Temp
12 98
13 99
14 97
City Time Temp
Dallas 12 98
Tulsa 13 99
Boise 14 97
To get available sheet names from file, call XLSFINO with two outputs.
For example:
[status, sheetNames] = xlsfinfo(FILENAME)
When reading date fields from Excel files, the date numbers need
conversion to a MATLAB date. For example, if your Excel file contains:
4/12/99
4/13/99
4/14/99
Convert the data to MATLAB dates like this:
excelDates = xlsread(FILENAME)
matlabDates = datenum('30-Dec-1899') + excelDates
----------------------------------------
----------------
| |||||||
| Post a new topic to the Research Area Discussion discussion | |||||||