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:lang="en" xml:id="mtlb_rand">
15
<refname>mtlb_rand</refname>
16
<refpurpose>Matlab rand emulation function</refpurpose>
19
<title>Description</title>
21
Matlab and Scilab <literal>rand</literal> behave differently in some particular cases:
26
With a scalar input: Matlab <literal>rand</literal> returns a n x n matrix
27
while Scilab returns a scalar.
32
The function <literal>mtlb_rand(A)</literal> is used by
33
<literal>mfile2sci</literal> to replace <literal>rand(A)</literal> when it was not
34
possible to know what was the input while porting Matlab code to Scilab. This function will
35
determine the correct semantic at run time. If you want to have a
36
more efficient code it is possible to replace <literal>mtlb_rand</literal> calls:
41
If <literal>A</literal> is a scalar
42
<literal>mtlb_rand(A)</literal> may be replaced by <literal>rand(A,A)</literal>
47
If <literal>A</literal> is not a scalar
48
<literal>mtlb_rand(A)</literal> may be replaced by <literal>rand(A)</literal>
53
Caution: <literal>mtlb_rand</literal> has not to be used for hand coded functions.
15
<refname>mtlb_rand</refname>
16
<refpurpose>Matlab rand emulation function</refpurpose>
19
<title>Description</title>
21
Matlab and Scilab <literal>rand</literal> behave differently in some particular cases:
26
With a scalar input: Matlab <literal>rand</literal> returns a n x n matrix
27
while Scilab returns a scalar.
32
The function <literal>mtlb_rand(A)</literal> is used by
33
<literal>mfile2sci</literal> to replace <literal>rand(A)</literal> when it was not
34
possible to know what was the input while porting Matlab code to Scilab. This function will
35
determine the correct semantic at run time. If you want to have a
36
more efficient code it is possible to replace <literal>mtlb_rand</literal> calls:
41
If <literal>A</literal> is a scalar
42
<literal>mtlb_rand(A)</literal> may be replaced by <literal>rand(A,A)</literal>
47
If <literal>A</literal> is not a scalar
48
<literal>mtlb_rand(A)</literal> may be replaced by <literal>rand(A)</literal>
53
Caution: <literal>mtlb_rand</literal> has not to be used for hand coded functions.