* Bug 14606 fixed: now `[names,mem]=who()` returns memory used by variables
[scilab.git] / scilab / modules / core / help / en_US / variables / who.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="who">
3     <refnamediv>
4         <refname>who</refname>
5         <refpurpose>listing of variables</refpurpose>
6     </refnamediv>
7     <refsynopsisdiv>
8         <title>Syntax</title>
9         <synopsis>who
10             who()
11             [names, mem] = who([mode], [sorted])
12         </synopsis>
13     </refsynopsisdiv>
14     <refsection>
15         <title>Arguments</title>
16         <variablelist>
17             <varlistentry>
18                 <term>mode</term>
19                 <listitem>
20                     <para>
21                         <literal>local</literal>/<literal>get</literal>: list visible variables (not only in current function).
22                     </para>
23                     <para>
24                         <literal>scope</literal>/<literal>current</literal>: list variables in the current scope/function.
25                     </para>
26                     <para>
27                         <literal>global</literal>: list global variables.
28                     </para>
29                 </listitem>
30             </varlistentry>
31             <varlistentry>
32                 <term>sorted</term>
33                 <listitem>
34                     <para>
35                         Boolean value to specify if output must be sort in alphabetical order.
36                     </para>
37                 </listitem>
38             </varlistentry>
39             <varlistentry>
40                 <term>names</term>
41                 <listitem>
42                     <para>String matrix with variable names.</para>
43                 </listitem>
44             </varlistentry>
45             <varlistentry>
46                 <term>mem</term>
47                 <listitem>
48                     <para>Double matrix with variable used memory in bytes.</para>
49                 </listitem>
50             </varlistentry>
51         </variablelist>
52     </refsection>
53     <refsection>
54         <title>Examples</title>
55         <programlisting role="example"><![CDATA[
56 a=1;
57 b=2;
58 [name, mem]=who("local");
59 position=find(name=="a")
60 mem(position) // Size used by a
61 position=find(name=="d") // []
62
63 function foo(a,b)
64     disp(who("scope", "sorted"))
65 endfunction
66
67 foo(1,2);
68
69  ]]></programlisting>
70     </refsection>
71     <refsection role="see also">
72         <title>See also</title>
73         <simplelist type="inline">
74             <member>
75                 <link linkend="whos">whos</link>
76             </member>
77             <member>
78                 <link linkend="who_user">who_user</link>
79             </member>
80         </simplelist>
81     </refsection>
82     <refsection role="history">
83         <title>History</title>
84         <revhistory>
85             <revision>
86                 <revnumber>6.0.1</revnumber>
87                 <revdescription>
88                     Add "scope" or "current" mode.
89                 </revdescription>
90             </revision>
91         </revhistory>
92     </refsection>
93 </refentry>