Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - 日本語 - Русский
Ajuda do Scilab >> Preferences > setPreferencesValue


Set preferences value


setPreferencesValue(xpath, key_value [, doc])



a string, represents the XPath request to get the node in the preferences file.


a 2xN matrix of strings, the key-values to set.


a mlist typed XMLDoc, the XML document associated to the preference file.


Set the values of the attributes in preferences file (SCIHOME+'/XConfiguration.xml').

Modifying incorrectly some preferences can alter Scilab's behaviour.

When doc is specified, the values are searched in this document. It is useful when several requests need to be done to avoid to parse again and again the same configuration file.

All valid XPath requests are possible. For example to write the XPath request to set proxy settings:

  • Open the file SCIHOME+'/XConfiguration.xml' and gets the nodes names to access to the expected node:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <interface height="600" path="1/" version="0.17" width="800">
        <general title="_(General)">
        <web title="_(Web)">
                <web command-browser="" command-mailer="" default-browser="true" default-mailer="true"/>
                <proxy enabled="false" host="" password="" port="" user=""/>
                <previous-proxy enabled="false" host="" password="" port="" user=""/>

    The path will be "/interface/web/body/proxy" (or to simplify "//web/body/proxy").


// Get the current values
prev = xmlGetValues("//web/body/proxy", ["enabled", "host", "port"]);
setPreferencesValue("//web/body/proxy", ["enabled", "host", "port"; "true", "", "1234"]);

// Ok that's work
xmlGetValues("//web/body/proxy", ["enabled", "host", "port"])

// We restore the previous values
setPreferencesValue("//web/body/proxy", ["enabled", "host", "port" ; prev]);
xmlGetValues("//web/body/proxy", ["enabled", "host", "port"])

See also

  • xmlGetValues — Parses and gets values of chosen tags attributes in a XML file of preferences
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:01:11 CET 2019