A smart interface to MatLab that can easily be used from Office
This minimal example should help in understanding the very basics of how the library operates in terms of creating a MatLab figure. Obviously in this very minimal case there is really no advantage to using this Library.
With this Basic figure we introduce a few of the Library features; Property Shortcuts, Enumerations and the Spline form.
Lib.Execute "x = 0:pi/3:3*pi"
Lib.Execute "y = sin(x-pi/2)"
Lib.Figure.Classification = "Unclassified"
Lib.Figure.Information = "Figure information goes here... | You can add additional lines by using a vertical bar"
Dim plot As COMforMatLab.plot
Set plot = Lib.Figure.plot(1)
plot.Signal(1).Name = "y"
plot.Signal(1).Point = ePoint.Square
plot.Signal(1).Color = eColor.Red
plot.Signal(1).Form = eForm.Spline
plot.Axis.X.Label = "X"
plot.Axis.Y.Label = "Y"
With this more involved example we introduce multiple Signals, Axis Scaling , Limiting and a number of Markers.
See the help file for the Library code involved to create this. The important point is that it took about 50 lines of high-level VBA code vs 100+ lines of complex MatLab commands.
This Library feature gives you more plotting flexibility that can also be used along with various Library features.
A single complex value example is shown her. Both reading and writing of values are fully supported of course.
Simple example of sending Matrix (array) data to MatLab. Both read and write along with real and complex values are fully supported.
There are a number of cases where your data is not numeric. This data function makes it easy to get the data into MatLab. Both a string value (as shown) or arrays are supported.
If you deal with databases, all of your data is in the form of tables/queries. The Recordset Object (ADO in particular) you can use this Library function to effortlessly get your data into MatLab with one line of code.
The use of a well designed object Library is the key to making MatLab easier to work with. The "Library" is the top level object, all other objects are referenced from here. The "Configure" method opens up the Configuration dialog which allows you to set a number of defaults which makes creating MatLab figures easier.
The "Figure" object is the object where MatLab figures can be created with. For detailed information on this object please download the included help (.chm) file.
As was shown above, the "Data" object is how you can efficiently read and write data between your Office application and MatLab. The "Display" method opens a display of the data related to current Plot. This is particularly useful so that you don't have to open up the full MatLab user interface.
The "Log" object can be used to log all commands sent to MatLab. The "Display" method shows you these commands. You can later use these commands to run directly in MatLab as a form of "canned" scripts.