~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/m2sci/help/en_US/m2sci_equivalents/a/any.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 *
12
12
 -->
13
13
<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" version="5.0-subset Scilab" xml:id="m2sci_any">
14
 
  <refnamediv>
15
 
    <refname>any (Matlab function)</refname>
16
 
    <refpurpose>Test to determine if any nonzeros elements</refpurpose>
17
 
  </refnamediv>
18
 
  <refsection>
19
 
    <title>Matlab/Scilab equivalent</title>
20
 
    <informaltable border="1" width="100%">
21
 
      <tr>
22
 
        <td align="center">
23
 
          <emphasis role="bold">Matlab</emphasis>
24
 
        </td>
25
 
        <td align="center">
26
 
          <emphasis role="bold">Scilab</emphasis>
27
 
        </td>
28
 
      </tr>
29
 
      <tr>
30
 
        <td>
31
 
          <programlisting role="example"><![CDATA[
 
14
    <refnamediv>
 
15
        <refname>any (Matlab function)</refname>
 
16
        <refpurpose>Test to determine if any nonzeros elements</refpurpose>
 
17
    </refnamediv>
 
18
    <refsection>
 
19
        <title>Matlab/Scilab equivalent</title>
 
20
        <informaltable border="1" width="100%">
 
21
            <tr>
 
22
                <td align="center">
 
23
                    <emphasis role="bold">Matlab</emphasis>
 
24
                </td>
 
25
                <td align="center">
 
26
                    <emphasis role="bold">Scilab</emphasis>
 
27
                </td>
 
28
            </tr>
 
29
            <tr>
 
30
                <td>
 
31
                    <programlisting role="example"><![CDATA[
32
32
any
33
33
]]></programlisting>
34
 
        </td>
35
 
        <td>
36
 
          <programlisting role="example"><![CDATA[
 
34
                </td>
 
35
                <td>
 
36
                    <programlisting role="example"><![CDATA[
37
37
or
38
38
]]></programlisting>
39
 
        </td>
40
 
      </tr>
41
 
    </informaltable>
42
 
  </refsection>
43
 
  <refsection>
44
 
    <title>Particular cases</title>
45
 
    <para>
46
 
Matlab <emphasis role="bold">any</emphasis> function can work with complexes, what Scilab <emphasis role="bold">or</emphasis> can not, so a call to <emphasis role="bold">abs</emphasis> function can be necessary when translating from Matlab to Scilab.
47
 
</para>
48
 
    <variablelist>
49
 
      <varlistentry>
50
 
        <term>Matlab expression <emphasis role="bold">B=any(A)</emphasis> translated into Scilab by <emphasis role="bold">B=or(A)</emphasis>:</term>
51
 
        <listitem>
52
 
          <para>
53
 
If <emphasis role="bold">A</emphasis> is a matrix, <emphasis role="bold">any(A)</emphasis> is equivalent to <emphasis role="bold">any(A,1)</emphasis> in Matlab whereas in Scilab <emphasis role="bold">or(A)</emphasis> is a logical OR of all elements of <emphasis role="bold">A</emphasis>. If <emphasis role="bold">A</emphasis> is a multidimensional array then Matlab treats the values along the first non-singleton dimension, but Scilab returns logical OR of all elements of <emphasis role="bold">A</emphasis>.
54
 
</para>
55
 
        </listitem>
56
 
      </varlistentry>
57
 
      <varlistentry>
58
 
        <term>Matlab expression <emphasis role="bold">B=any(A,dim)</emphasis> translated into Scilab by <emphasis role="bold">B=or(A,dim)</emphasis>:</term>
59
 
        <listitem>
60
 
          <para>
61
 
In Scilab <emphasis role="bold">dim=1</emphasis> is equivalent to <emphasis role="bold">dim="r"</emphasis> and <emphasis role="bold">dim=2</emphasis> is equivalent to <emphasis role="bold">dim="c"</emphasis>. In Matlab, <emphasis role="bold">dim</emphasis> can be greater then the number of dimension of <emphasis role="bold">A</emphasis> (in this case, <emphasis role="bold">B=A</emphasis>), in Scilab you will get an error message.
62
 
</para>
63
 
        </listitem>
64
 
      </varlistentry>
65
 
    </variablelist>
66
 
  </refsection>
67
 
  <refsection>
68
 
    <title>Examples</title>
69
 
    <informaltable border="1" width="100%">
70
 
      <tr>
71
 
        <td align="center">
72
 
          <emphasis role="bold">Matlab</emphasis>
73
 
        </td>
74
 
        <td align="center">
75
 
          <emphasis role="bold">Scilab</emphasis>
76
 
        </td>
77
 
      </tr>
78
 
      <tr>
79
 
        <td>
80
 
          <programlisting role="example"><![CDATA[
 
39
                </td>
 
40
            </tr>
 
41
        </informaltable>
 
42
    </refsection>
 
43
    <refsection>
 
44
        <title>Particular cases</title>
 
45
        <para>
 
46
            Matlab <emphasis role="bold">any</emphasis> function can work with complexes, what Scilab <emphasis role="bold">or</emphasis> can not, so a call to <emphasis role="bold">abs</emphasis> function can be necessary when translating from Matlab to Scilab.
 
47
        </para>
 
48
        <variablelist>
 
49
            <varlistentry>
 
50
                <term>
 
51
                    Matlab expression <emphasis role="bold">B=any(A)</emphasis> translated into Scilab by <emphasis role="bold">B=or(A)</emphasis>:
 
52
                </term>
 
53
                <listitem>
 
54
                    <para>
 
55
                        If <emphasis role="bold">A</emphasis> is a matrix, <emphasis role="bold">any(A)</emphasis> is equivalent to <emphasis role="bold">any(A,1)</emphasis> in Matlab whereas in Scilab <emphasis role="bold">or(A)</emphasis> is a logical OR of all elements of <emphasis role="bold">A</emphasis>. If <emphasis role="bold">A</emphasis> is a multidimensional array then Matlab treats the values along the first non-singleton dimension, but Scilab returns logical OR of all elements of <emphasis role="bold">A</emphasis>.
 
56
                    </para>
 
57
                </listitem>
 
58
            </varlistentry>
 
59
            <varlistentry>
 
60
                <term>
 
61
                    Matlab expression <emphasis role="bold">B=any(A,dim)</emphasis> translated into Scilab by <emphasis role="bold">B=or(A,dim)</emphasis>:
 
62
                </term>
 
63
                <listitem>
 
64
                    <para>
 
65
                        In Scilab <emphasis role="bold">dim=1</emphasis> is equivalent to <emphasis role="bold">dim="r"</emphasis> and <emphasis role="bold">dim=2</emphasis> is equivalent to <emphasis role="bold">dim="c"</emphasis>. In Matlab, <emphasis role="bold">dim</emphasis> can be greater then the number of dimension of <emphasis role="bold">A</emphasis> (in this case, <emphasis role="bold">B=A</emphasis>), in Scilab you will get an error message.
 
66
                    </para>
 
67
                </listitem>
 
68
            </varlistentry>
 
69
        </variablelist>
 
70
    </refsection>
 
71
    <refsection>
 
72
        <title>Examples</title>
 
73
        <informaltable border="1" width="100%">
 
74
            <tr>
 
75
                <td align="center">
 
76
                    <emphasis role="bold">Matlab</emphasis>
 
77
                </td>
 
78
                <td align="center">
 
79
                    <emphasis role="bold">Scilab</emphasis>
 
80
                </td>
 
81
            </tr>
 
82
            <tr>
 
83
                <td>
 
84
                    <programlisting role="example"><![CDATA[
81
85
y = any([1,1,0;1,0,1])
82
86
y = [1,1,1]
83
87
y = any([1,1,0;1,0,1],1)
84
88
y = [1,1,1]
85
89
]]></programlisting>
86
 
        </td>
87
 
        <td>
88
 
          <programlisting role="example"><![CDATA[
 
90
                </td>
 
91
                <td>
 
92
                    <programlisting role="example"><![CDATA[
89
93
y = or([1,1,0;1,0,1])
90
94
y = %T
91
95
y = or([1,1,0;1,0,1],1)
92
96
y = [%T,%T,%T]
93
97
]]></programlisting>
94
 
        </td>
95
 
      </tr>
96
 
    </informaltable>
97
 
  </refsection>
 
98
                </td>
 
99
            </tr>
 
100
        </informaltable>
 
101
    </refsection>
98
102
</refentry>