Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open MS Excel by Matlab

Tags:

excel

matlab

is there a way how to make Matlab open excel files directly in MS Excel? I do not mean just read data, but physically open MS Excel. I have a script that processes some data and saves it into .xlsm. This .xlsm contains auto_open macro which generates a report and saves it into another .xls. I want the process to be as automatic as possible. So far, when the matlab script ends, .xlsm file needs to be open manually. Is it possible to do it via Matlab? (The .m file and .xlsm are in the same folder.)

like image 832
Martin Avatar asked Jan 17 '23 05:01

Martin


2 Answers

The simplest way to open (but not close) an Excel file is to use WINOPEN:

winopen('myFile.xlsx')
like image 113
Jonas Avatar answered Jan 22 '23 04:01

Jonas


Excel has a powerful COM interface that lets you control it from another application.

Look here for the matlab side of things

http://www.mathworks.co.uk/help/techdoc/ref/actxserver.html

And here for an example of putting it all together . . .

https://www.quantnet.com/forum/threads/interface-between-matlab-vba-excel.2090/

or here is another example

http://www.mathworks.co.uk/support/solutions/en/data/1-716EAM/index.html?solution=1-716EAM

like image 29
learnvst Avatar answered Jan 22 '23 05:01

learnvst