0
votes

I ask more in hope than expectation but is there anyway to import an excel spreadsheet into Matlab including the functions?

The sheet I am looking to import in enormous and so will require a huge effort to replicate it in Matlab so I have to ask.

I realise with the Excel add-in I can call excel from Matlab and vice versa. However one of the reasons that I am looking to import it into Matlab is that (due to it's immense size) the excel spreadsheet is really creaking (requiring 30s+ to do one update) so ideally I don't want to have them dynamically linked. I wonder however if I could use the link to import the data + forumlas? If someone has already done something similar I would love to see the code.

Also as an aside will importing into Matlab give me any appreciable speed up compared to the basic excel sheet? (I have other reasons for wanting to do the import (such as the tremendous library of functions in Matlab) but it would be good to know, what kind of performance gain (if any) I can expect.

1
I don't think xlsread can import formulas, only data and text in cells, but my guess is that you will see an enormous improvement in computation speed. Excel was designed primarily as an accounting package, not for engineering calculations and data analysis. - am304
You can use xlsread to get the data but I highly highly doubt you'll be able to import the functions. Like 99.9999% certain that you can't. Depending on what your sheet is trying to do, and depending on how you code your Matlab, there is a fair chance you'll be able to get ample speed up by importing the data and rewriting all the formulae - Dan

1 Answers

0
votes

You cannot import directly your formulas in MATLAB. MATLAB cannot understand them.

I think the best solution for you is to rewrite all the formulas, and this is because MATLAB can handle very quickly huge amounts of data, while Excel can't.

A quick solution for importing your data (not formulas!) in MATLAB would be exporting your file in CSV format and then reading them by using the csvread function: http://www.mathworks.it/it/help/matlab/ref/csvread.html

yourData = csvread(filename)

Note: googling around you can find some nice solutions like the following: http://www.codeproject.com/Tips/535390/Write-to-Excel-Sheet-through-Matlab To my knowledge, the reverse operation is neither already implemented nor suggested, since you are handling a lot of data. However, you may find something implemented in this direction.