[Scilab-users] Get random number from a matrix

Pierre-Aimé Agnel pierre-aime.agnel at scilab-enterprises.com
Mon Jun 9 08:40:09 CEST 2014


Hi,

The functions already exists for different kind of sampling (based on grand)
https://help.scilab.org/docs/5.5.0/en_US/sample.html
https://help.scilab.org/docs/5.5.0/en_US/samplef.html
https://help.scilab.org/docs/5.5.0/en_US/samwr.html

They also sample from rows/columns

Regards

On 06/08/2014 01:20 PM, A Khorshidi wrote:
> Samuel GOUGEON wrote
>> Le 07/06/2014 02:30, Chuox a écrit :
>>> i found this solution, but i'm guessing there must be a more easy and
>>> efficient solution.
>> not really, may be just a little shorter:
>>
>> Matrix = [25 ,32 ,40, 50] ;
>> random = Matrix(grand(1,1,"uin",1,length(Matrix)))
>>
>> If Matrix is rather of text, length(Matrix) must be replaced with
>> size(Matrix,"*")
>>
>> Regards
> Hi all;
>
> Samuel, I think it will be handy if we have a function which can extract
> randomly one, two or more entities of a matrix as well as can also be used
> to return a random row/column of a matrix.
> Attached you can see a preliminary version of that function.
>
> Regards,
> Mehran
>
> random_extraction.sce
> <http://mailinglists.scilab.org/file/n4030697/random_extraction.sce>
>
> _
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Get-random-number-from-a-matrix-tp4030691p4030697.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Pierre-Aimé Agnel
Development Team
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
http://www.scilab-enterprises.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140609/4d7feb06/attachment.htm>


More information about the users mailing list