|
|
|
|
Escribe el valor de una Variable para la sesión de MATLAB. gnSessionID is int gnSessionID = mlInitialize() IF gnSessionID = -1 THEN Error(ErrorInfo(errFullDetails)) END // Code of BTN_Create_Variables button aParameter is array of 1 real = [4] aResult is array of 1 by 1 real = [[123]] IF NOT mlSetVariable(gnSessionID, "i", aParameter) THEN Error("Failure writing the variable") RETURN END sCodeToRun is string = "myRoot = sqrt(i)" EDT_Result = mlExecute(gnSessionID, sCodeToRun) aResult = mlGetVariable(gnSessionID, "myRoot") IF ErrorOccurred THEN Trace("Error : " + ErrorInfo()) END Trace("Root = " + aResult[1,1]) Trace("List of variables before deletion : " + mlListVariable(gnSessionID)) mlDeleteVariable(gnSessionID, "i") mlDeleteVariable(gnSessionID, "myRoot") Trace("List of variables after deletion : " + mlListVariable(gnSessionID))
Sintaxis
<Result> = mlSetVariable(<Session identifier> , <Variable name> , <Value>)
<Result>: booleano - True si se modificó la variable,
- False en caso contrario. Si se produce un error, la variable ErrorOccurred se pone en True. Para obtener más información sobre el error, utilice la función ErrorInfo con la constante errMessage.
<Session identifier>: Integro Identificador de la sesión de MATLAB. Este identificador es devuelto por mlInitialize. <Variable name>: Cadena de caracteres Nombre de la Variable a escribir. <Value>: Array de números enteros, reales, ... Valor de Variable. Observaciones Tipos soportados Los tipos soportados son: - enteros con y sin signo en 1, 2, 4 y 8,
- en el 4 y el 8,
- booleans,
- caracteres.
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|