* Bug #13409 fixed - permute(x, dims) failed when dims was greater than the dimension...
[scilab.git] / scilab / modules / elementary_functions / help / en_US / matrixmanipulation / permute.xml
index 1ab7a8b..ae8dfd2 100644 (file)
@@ -2,11 +2,11 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA - Farid BELAHCENE
- * 
+ *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
- * are also available at    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
  *
  -->
     <refsection>
         <title>Description</title>
         <para>
-            <literal>Permute the dimensions of an array.</literal>
+            Permutes the dimensions of an array according to <varname>dims</varname>.
+        </para>
+        <para>
+            Input argument <varname>dims</varname> must be a valid permutation where dimension <literal>#i</literal> becomes <literal>#dims(i)</literal>.
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 //example 1:
-x=[1 2 3;4 5 6];
-y=permute(x,[2 1]);
+x=[1 2 3;4 5 6]
+y=permute(x,[2 1])
 
 //example 2:
-x=matrix(1:12,[2,3,2]);
-y=permute(x,[3 1 2]);
+x=matrix(1:12,[2,3,2])
+y=permute(x,[3 1 2])
+
+x = matrix(1:12, [3 2 2])
+y = permute(x, [3 4 1 2])
+// Dimensions are changed according to dims
+// #1=rows    becomes #3=pages
+// #2=columns becomes #4=books
+// #3=pages   becomes #1=rows
+// #4=books   becomes #2=columns
  ]]></programlisting>
     </refsection>
     <refsection role="see also">