|
|
|
|
|
mlSetVariable (Function) In french: mlEcritVariable Writes the value of a variable for the MATLAB session. gnIdSession is int
gnIdSession = mlInitialize()
IF gnIdSession = -1 THEN
Error(ErrorInfo(errFullDetails))
END
tParamètre is array of 1 real = [4]
tRésultat is array of 1 by 1 real = [[123]]
IF NOT mlSetVariable(gnIdSession, "i", tParamètre) THEN
Error("Echec d'écriture de la variable")
RETURN
END
sCodeAExécuter is string = "maRac = sqrt(i)"
SAI_Résultat = mlExecute(gnIdSession, sCodeAExécuter)
tRésultat = mlGetVariable(gnIdSession, "maRac")
IF ErrorOccurred THEN
Trace("Erreur : " + ErrorInfo())
END
Trace("Racine = " + tRésultat[1,1])
Trace("Liste des variables avant suppression : " + mlListVariable(gnIdSession))
mlDeleteVariable(gnIdSession, "i")
mlDeleteVariable(gnIdSession, "maRac")
Trace("Liste des variables après suppression : " + mlListVariable(gnIdSession))
Syntax
<Result> = mlSetVariable(<Session identifier> , <Variable name> , <Value>)
<Result>: Boolean - True if the variable was modified,
- False otherwise. If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo with the errMessage constant.
<Session identifier>: Integer Identifier of MATLAB session. This identifier is returned by mlInitialize. <Variable name>: Character string Name of the variable to write. <Value>: Array of integers, reals, ... Value of the variable. Remarks Supported types The supported types are: - signed and unsigned integers on 1, 2, 4 and 8,
- reals on 4 and 8,
- booleans,
- characters.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|