Reads and Writes the MatLab variable Name with a Value.

Read:    Value = Lib.Data.Value("Name" [,Imag])
Write:   Lib.Data.Value("Name" [,Imag])= Value

Name:  (String) The Name of the MatLab variable to be written to.
Imag:   (Boolean - Optional) = True, False (default=Real)  See Note*
Value:  (Variant = can be any type) The numeric value(s) that are written to "Name".

Note:  You must set the real part of the value first before setting the imaginary part.  Also, setting the real part after setting the imaginary part again will erase the imaginary part.


Example:  Writes the MatLab variable "dvalue" to 1.234 and then adds an imaginary value of 5.678

VBA:

Dim d As Single
d = 1.234
Lib.Data.Value("D Value") = d



To add a complex value, add the following code:

    d = 5.678
    Lib.Data.Value("D Value", True) = d




Example:  Reads the MatLab real and imaginary parts of the variable "dvalue".

VBA:

Dim dreal as Double
Dim dimag as Double
dreal = Lib.Data.Value("D Value")
dimag = Lib.Data.Value("D Value", True)


Note on Properties:

Properties of a MatLab object cannot be returned directly.

For example, you want to get the position coordinates of a handle (h) of a MatLab object, this will not work.

x= Lib.Data.Value("h.Position")  

What you will need to do is get the position values indirectly.

Lib.Execute "hpos = h.Position"
x= Lib.Data.Value("hpos")