d6fe7679d5ac2916c52bd91d0eebafef87a91436
[scilab.git] / scilab / modules / compatibility_functions / help / en_US / mtlb_e.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3     * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4     * Copyright (C) 2004-2007 - INRIA - Vincent COUVERT 
5     * 
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14     *
15     -->
16 <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="mtlb_e">
17     <refnamediv>
18         <refname>mtlb_e</refname>
19         <refpurpose>Matlab extraction emulation function</refpurpose>
20     </refnamediv>
21     <refsection>
22         <title>Description</title>
23         <para>Matlab and Scilab extraction behave differently in some particular cases:</para>
24         <itemizedlist>
25             <listitem>
26                 <para>
27                     When extracting data from a matrix with a vector as index: Matlab returns
28                     a row vector and Scilab returns a column vector.
29                 </para>
30             </listitem>
31             <listitem>
32                 <para>
33                     When extracting data from a character string matrix: due to the fact that character string matrices
34                     in Matlab can be addressed as any other matrix (each character can be adressed), extraction in such a type of
35                     matrix does not differ from other. But in Scilab it can't be done so and <literal>part</literal>
36                     function has to be used. 
37                 </para>
38             </listitem>
39         </itemizedlist>
40         <para>
41             The function <literal>mtlb_e(B,k)</literal> is used by
42             <literal>mfile2sci</literal> to replace <literal>A=B(k)</literal> when it was not
43             possible to know what were the operands while porting Matlab code to Scilab. This function will
44             determine the correct semantic at run time. If you want to have a
45             more efficient code it is possible to replace <literal>mtlb_e</literal> calls:
46         </para>
47         <itemizedlist>
48             <listitem>
49                 <para>    
50                     If <literal>B</literal> is a vector
51                     <literal>A=mtlb_e(B,k)</literal> may be replaced by <literal>A=B(k)</literal>
52                 </para>
53             </listitem>
54             <listitem>
55                 <para>    
56                     If <literal>B</literal> is a matrix
57                     <literal>A=mtlb_e(B,k)</literal> may be replaced by <literal>A=B(k).'</literal>
58                 </para>
59             </listitem>
60             <listitem>
61                 <para>    
62                     If <literal>B</literal> is a character string matrix and
63                     k is a scalar or a vector
64                     <literal>A=mtlb_e(B,k)</literal> may be replaced by <literal>A=part(B,k)</literal>
65                 </para>
66             </listitem>
67         </itemizedlist>
68         <para>
69             <warning>
70                 Caution: <literal>mtlb_e</literal> has not to be used for hand coded functions.
71             </warning>
72         </para>
73     </refsection>
74     <refsection role="see also">
75         <title>See Also</title>
76         <simplelist type="inline">
77             <member>
78                 <link linkend="MatlabScilab_character_strings">Matlab-Scilab_character_strings</link>
79             </member>
80             <member>
81                 <link linkend="part">part</link>
82             </member>
83         </simplelist>
84     </refsection>
85 </refentry>