Using other data in Excel add in
Afficher commentaires plus anciens
This question is about using the Library compiler to create add ins for Excel. Any help or suggestions would be much appreciated.
The library compiler creates a class (default called Class1). Any functions that you add become methods of that class. My question is about the best way to use other data (not stored in Excel) in those functions.
Here's a simplified example that illustrates my issue. I have a Matlab function (Function1) that takes a single input of a column vector (n x 1). Function1 multiplies this input column vector by a (n x n) square matrix and outputs the result (which is another column vector of size n x 1). The input column vector is always multiplied by the same square matrix. The user regularly changes the input column vector and then looks at the output. At the moment, I have the square matrix saved in a workspace. When Function1 runs, it loads the workspace in order to used the square matrix.
[In reality, the data loaded from the workspace is large and varied: multi-dimensional arrays of numbers, as well as various categorical arrays, so reading it all from excel isn't my preferred option]
My issue with the system above is that every time the function runs, it loads the data, which seems to add an overhead. Is there any way for the data to be loaded once at the start and then accessed when the function runs on subsequent times?
One option that would solve my issue is if the data could be saved as class members of Class1. Is there anyway to add members/properties to Class1? The library complier dialogue only seems to let you add methods.
Thanks in advance!
2 commentaires
Jayaram Theegala
le 15 Déc 2017
When you say, " At the moment, I have the square matrix saved in a workspace" do you mean loading a MAT file that loads all the Workspace variables or some other file that has the nxn matrix that you are multiplying with the input?
If that is not correct, please do elaborate on what you mean by loading workspace and the exact steps you are following to load the nxn matrix, because the term "Workspace" can easily be confused with MATLAB Workspace, which is not accessible while running an Excel Addin created using MATLAB Compiler.
JE101
le 18 Déc 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import from MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!