<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>User-Defined Preferences (GNU Octave (version 5.1.0))</title> <meta name="description" content="User-Defined Preferences (GNU Octave (version 5.1.0))"> <meta name="keywords" content="User-Defined Preferences (GNU Octave (version 5.1.0))"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="GUI-Development.html#GUI-Development" rel="up" title="GUI Development"> <link href="System-Utilities.html#System-Utilities" rel="next" title="System Utilities"> <link href="GUI-Utility-Functions.html#GUI-Utility-Functions" rel="prev" title="GUI Utility Functions"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> <link rel="stylesheet" type="text/css" href="octave.css"> </head> <body lang="en"> <a name="User_002dDefined-Preferences"></a> <div class="header"> <p> Previous: <a href="GUI-Utility-Functions.html#GUI-Utility-Functions" accesskey="p" rel="prev">GUI Utility Functions</a>, Up: <a href="GUI-Development.html#GUI-Development" accesskey="u" rel="up">GUI Development</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="User_002dDefined-Preferences-1"></a> <h3 class="section">35.5 User-Defined Preferences</h3> <a name="XREFgetpref"></a><dl> <dt><a name="index-getpref"></a><em><var>val</var> =</em> <strong>getpref</strong> <em>("<var>group</var>", "<var>pref</var>")</em></dt> <dt><a name="index-getpref-1"></a><em><var>val</var> =</em> <strong>getpref</strong> <em>("<var>group</var>", "<var>pref</var>", <var>default</var>)</em></dt> <dt><a name="index-getpref-2"></a><em>{<var>val1</var>, <var>val2</var>, …} =</em> <strong>getpref</strong> <em>("<var>group</var>", {"<var>pref1</var>", "<var>pref2"</var>, …})</em></dt> <dt><a name="index-getpref-3"></a><em><var>prefstruct</var> =</em> <strong>getpref</strong> <em>("<var>group</var>")</em></dt> <dt><a name="index-getpref-4"></a><em><var>prefstruct</var> =</em> <strong>getpref</strong> <em>()</em></dt> <dd><p>Return the preference value corresponding to the named preference <var>pref</var> in the preference group <var>group</var>. </p> <p>The named preference group must be a string. </p> <p>If <var>pref</var> does not exist in <var>group</var> and <var>default</var> is specified, create the preference with value <var>default</var> and return <var>default</var>. </p> <p>The preference <var>pref</var> may be a string or cell array of strings. If it is a cell array of strings then a cell array of preferences is returned. </p> <p>The corresponding default value <var>default</var> may be any Octave value, .e.g., double, struct, cell array, object, etc. Or, if <var>pref</var> is a cell array of strings then <var>default</var> must be a cell array of values with the same size as <var>pref</var>. </p> <p>If neither <var>pref</var> nor <var>default</var> are specified, return a structure of preferences for the preference group <var>group</var>. </p> <p>If no arguments are specified, return a structure containing all groups of preferences and their values. </p> <p><strong>See also:</strong> <a href="#XREFaddpref">addpref</a>, <a href="#XREFsetpref">setpref</a>, <a href="#XREFispref">ispref</a>, <a href="#XREFrmpref">rmpref</a>. </p></dd></dl> <a name="XREFsetpref"></a><dl> <dt><a name="index-setpref"></a><em></em> <strong>setpref</strong> <em>("<var>group</var>", "<var>pref</var>", <var>val</var>)</em></dt> <dt><a name="index-setpref-1"></a><em></em> <strong>setpref</strong> <em>("<var>group</var>", {"<var>pref1</var>", "<var>pref2</var>", …}, {<var>val1</var>, <var>val2</var>, …})</em></dt> <dd><p>Set the preference <var>pref</var> to the given <var>val</var> in the named preference group <var>group</var>. </p> <p>The named preference group must be a string. </p> <p>The preference <var>pref</var> may be a string or a cell array of strings. </p> <p>The corresponding value <var>val</var> may be any Octave value, .e.g., double, struct, cell array, object, etc. Or, if <var>pref</var> is a cell array of strings then <var>val</var> must be a cell array of values with the same size as <var>pref</var>. </p> <p>If the named preference or group does not exist, it is added. </p> <p><strong>See also:</strong> <a href="#XREFaddpref">addpref</a>, <a href="#XREFgetpref">getpref</a>, <a href="#XREFispref">ispref</a>, <a href="#XREFrmpref">rmpref</a>. </p></dd></dl> <a name="XREFaddpref"></a><dl> <dt><a name="index-addpref"></a><em></em> <strong>addpref</strong> <em>("<var>group</var>", "<var>pref</var>", <var>val</var>)</em></dt> <dt><a name="index-addpref-1"></a><em></em> <strong>addpref</strong> <em>("<var>group</var>", {"<var>pref1</var>", "<var>pref2</var>", …}, {<var>val1</var>, <var>val2</var>, …})</em></dt> <dd><p>Add the preference <var>pref</var> and associated value <var>val</var> to the named preference group <var>group</var>. </p> <p>The named preference group must be a string. </p> <p>The preference <var>pref</var> may be a string or a cell array of strings. An error will be issued if the preference already exists. </p> <p>The corresponding value <var>val</var> may be any Octave value, .e.g., double, struct, cell array, object, etc. Or, if <var>pref</var> is a cell array of strings then <var>val</var> must be a cell array of values with the same size as <var>pref</var>. </p> <p><strong>See also:</strong> <a href="#XREFsetpref">setpref</a>, <a href="#XREFgetpref">getpref</a>, <a href="#XREFispref">ispref</a>, <a href="#XREFrmpref">rmpref</a>. </p></dd></dl> <a name="XREFrmpref"></a><dl> <dt><a name="index-rmpref"></a><em></em> <strong>rmpref</strong> <em>("<var>group</var>", "<var>pref</var>")</em></dt> <dt><a name="index-rmpref-1"></a><em></em> <strong>rmpref</strong> <em>("<var>group</var>", {"<var>pref1</var>", "<var>pref2</var>", …})</em></dt> <dt><a name="index-rmpref-2"></a><em></em> <strong>rmpref</strong> <em>("<var>group</var>")</em></dt> <dd><p>Remove the named preference <var>pref</var> from the preference group <var>group</var>. </p> <p>The named preference group must be a string. </p> <p>The preference <var>pref</var> may be a string or cell array of strings. </p> <p>If <var>pref</var> is not specified, remove the preference group <var>group</var>. </p> <p>It is an error to remove a nonexistent preference or group. </p> <p><strong>See also:</strong> <a href="#XREFaddpref">addpref</a>, <a href="#XREFispref">ispref</a>, <a href="#XREFsetpref">setpref</a>, <a href="#XREFgetpref">getpref</a>. </p></dd></dl> <a name="XREFispref"></a><dl> <dt><a name="index-ispref"></a><em></em> <strong>ispref</strong> <em>("<var>group</var>", "<var>pref</var>")</em></dt> <dt><a name="index-ispref-1"></a><em></em> <strong>ispref</strong> <em>("<var>group</var>", {"<var>pref1</var>", "<var>pref2"</var>, …})</em></dt> <dt><a name="index-ispref-2"></a><em></em> <strong>ispref</strong> <em>("<var>group</var>")</em></dt> <dd><p>Return true if the named preference <var>pref</var> exists in the preference group <var>group</var>. </p> <p>The named preference group must be a string. </p> <p>The preference <var>pref</var> may be a string or a cell array of strings. </p> <p>If <var>pref</var> is not specified, return true if the preference group <var>group</var> exists. </p> <p><strong>See also:</strong> <a href="#XREFgetpref">getpref</a>, <a href="#XREFaddpref">addpref</a>, <a href="#XREFsetpref">setpref</a>, <a href="#XREFrmpref">rmpref</a>. </p></dd></dl> <a name="XREFprefdir"></a><dl> <dt><a name="index-prefdir"></a><em></em> <strong>prefdir</strong></dt> <dt><a name="index-prefdir-1"></a><em></em> <strong>prefdir</strong> <em>(1)</em></dt> <dt><a name="index-prefdir-2"></a><em><var>dir</var> =</em> <strong>prefdir</strong></dt> <dd><p>Return the directory that holds the preferences for Octave. </p> <p>Examples: </p> <p>Display the preferences directory </p> <div class="example"> <pre class="example">prefdir </pre></div> <p>Change to the preferences folder </p> <div class="example"> <pre class="example">cd (prefdir) </pre></div> <p>If called with an argument, the preferences directory is created if it doesn’t already exist. </p> <p><strong>See also:</strong> <a href="#XREFgetpref">getpref</a>, <a href="#XREFsetpref">setpref</a>, <a href="#XREFaddpref">addpref</a>, <a href="#XREFrmpref">rmpref</a>, <a href="#XREFispref">ispref</a>. </p></dd></dl> <a name="XREFpreferences"></a><dl> <dt><a name="index-preferences"></a><em></em> <strong>preferences</strong></dt> <dd><p>Display the GUI preferences dialog window for Octave. </p></dd></dl> <hr> <div class="header"> <p> Previous: <a href="GUI-Utility-Functions.html#GUI-Utility-Functions" accesskey="p" rel="prev">GUI Utility Functions</a>, Up: <a href="GUI-Development.html#GUI-Development" accesskey="u" rel="up">GUI Development</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> </body> </html>