SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

December 20th, 2005, 2:56 pm

Hello everybody, does anybody know how is it possible to use clustering analysis with Matlab and how it is possible to export datas from Excel to Matlab and conversely ??Thank you in advance for your help.
 
User avatar
f95abl
Posts: 12
Joined: June 15th, 2005, 7:08 am

MATLAB, Clustering and Excel.....

December 21st, 2005, 11:40 am

There are standard routines in the statistics toolbox, http://www.mathworks.com/access/helpdes ... index.html with the basic function "cluster".As for exporting your results to Excel I'd use xlswrite or the ExcelLink add-in.- anders
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

December 21st, 2005, 1:57 pm

Thanks a lot f95abl, but xlswrite doesn't work. I don't know why..
 
User avatar
f95abl
Posts: 12
Joined: June 15th, 2005, 7:08 am

MATLAB, Clustering and Excel.....

December 22nd, 2005, 10:53 am

For me xlsread and xlswrite always work fine. Perhaps some trouble with versions? Of course you'll need to be a bit careful with the data type. If you want to mix different types you'll have to put them in a cell array but details about that should be in the help.
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

December 22nd, 2005, 12:00 pm

xlswrite is not in the Matlab help ... Do you know the syntax for this function ?
 
User avatar
f95abl
Posts: 12
Joined: June 15th, 2005, 7:08 am

MATLAB, Clustering and Excel.....

December 22nd, 2005, 12:18 pm

>> help xlswrite XLSWRITE Stores numeric array or cell array in Excel workbook. [SUCCESS,MESSAGE]=XLSWRITE(FILE,ARRAY,SHEET,RANGE) writes ARRAY to the Excel workbook, FILE, into the area, RANGE in the worksheet specified in SHEET. FILE and ARRAY must be specified. If either FILE or ARRAY is empty, a error is thrown and XLSWRITE terminates. The first worksheet of the workbook is the default. If SHEET does not exist, a new sheet is added at the end of the worksheet collection. If SHEET is an index larger than the number of worksheets, new sheets are appended until the number of worksheets in the workbook equals SHEET. The size defined by the RANGE should fit the size of ARRAY or contain only the first cell, e.g. 'A2'. If RANGE is larger than the size of ARRAY, Excel will fill the remainder of the region with #N/A. If RANGE is smaller than the size of ARRAY, only the sub-array that fits into RANGE will be written to FILE. The success of the operation is returned in SUCCESS and any accompanying message, in MESSAGE. On error, MESSAGE shall be a struct, containing the error message and message ID. See NOTE 1. [SUCCESS,MESSAGE]=XLSWRITE(FILE,ARRAY) writes ARRAY to the Excel workbook, FILE, starting at cell A1 of the first worksheet. The return values are as for the above example. XLSWRITE ARRAY FILE, is the command line version of the above example. INPUT PARAMETERS: file: string defining the workbook file to write to. Default directory is pwd; default extension 'xls'. array: m x n numeric array or cell array. sheet: string defining worksheet name; double, defining worksheet index. range: string defining data region in worksheet, using the Excel 'A1' notation. RETURN PARAMETERS: SUCCESS: logical scalar. MESSAGE: struct containing message field and message_id field. EXAMPLES: SUCCESS = XLSWRITE('c:\matlab\work\myworkbook.xls',A,'A2:C4') will write A to the workbook file, myworkbook.xls, and attempt to fit the elements of A into the rectangular worksheet region, A2:C4. On success, SUCCESS will contain true, while on failure, SUCCESS will contain false. NOTE 1: The above functionality depends upon Excel as a COM server. In absence of Excel, ARRAY shall be written as a text file in CSV format. In this mode, the SHEET and RANGE arguments shall be ignored. See also xlsread, wk1write, csvwrite. Reference page in Help browser doc xlswrite
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

December 22nd, 2005, 3:37 pm

THANKS A LOT f95abl ;by curiosity, for which application in finance do you use matlab?
 
User avatar
f95abl
Posts: 12
Joined: June 15th, 2005, 7:08 am

MATLAB, Clustering and Excel.....

December 22nd, 2005, 3:55 pm

You are most welcome.Portfolio optimization, clustering, parameter calibration (for instance building vol surfaces)... My experience is that once you learn to utilize the matrix computations whenever possible MATLAB is reasonably fast and yet its a high level program so development time is short.
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

December 22nd, 2005, 4:25 pm

Ok. I try to use Matlab for clustering analysis ; I have downloaded a file called DoClustering by David Corney. But it doesn't work. Do you know this file ?
 
User avatar
f95abl
Posts: 12
Joined: June 15th, 2005, 7:08 am

MATLAB, Clustering and Excel.....

December 23rd, 2005, 5:39 am

No, I've just simple used the routines in the Statistical Toolbox. Sorry.
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

December 23rd, 2005, 11:15 am

f95abl, could you send me the code for XLSWRITE, because I have got another function for that and it doesn't work ?? Thanks a lot
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

January 3rd, 2006, 7:18 am

Are you here f95abl ?
 
User avatar
BLOBY
Topic Author
Posts: 113
Joined: May 17th, 2004, 5:07 am

MATLAB, Clustering and Excel.....

January 18th, 2006, 2:40 pm

Does anybody have the code for XLSWRITE in Matlab ?? Because my version does not include this function.
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On