[Scilab-users] Generating a boolean vector or matrix

Stéphane Mottelet stephane.mottelet at utc.fr
Wed Sep 4 09:58:03 CEST 2019


Le 04/09/2019 à 09:39, Stéphane Mottelet a écrit :
>
> Hello,
>
> Le 04/09/2019 à 09:11, Federico Miyara a écrit :
>>
>> Dear all,
>>
>> I need to create a boolean vector, such as [%t, %t, %t, %t] but with 
>> a number of components given by a variable n. I couldn't find a 
>> function similar to ones(1,n).
>>
>> However I've found a workaround:
>>
>> a = ones(1,n) & %t
>>
>> It shouldn't work because ones(1,n) is not boolean, but it does.
>>
>> Questions:
>> 1) Why does it work?
>> 2) Is there some native function to create bolean matrices
>> 3) If not, are there any plans to introduce functions such as 
>> true(m,n) or false(m,n)?
>
> Yes, there :
>
> https://codereview.scilab.org/#/c/19964/
>
> S.
>
with the following syntax:

ones(n,m,"boolean")
zeros(n,m,"boolean")

The patch is ready since Apr 19, 2018. If you think that it should be 
included in the next Scilab version, just express you interest !

>
>>
>> Thank you.
>>
>> Federico Miyara
>>
>> <https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
>> 	Libre de virus. www.avast.com 
>> <https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
>>
>>
>> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
> -- 
> Stéphane Mottelet
> Ingénieur de recherche
> EA 4297 Transformations Intégrées de la Matière Renouvelable
> Département Génie des Procédés Industriels
> Sorbonne Universités - Université de Technologie de Compiègne
> CS 60319, 60203 Compiègne cedex
> Tel : +33(0)344234688
> http://www.utc.fr/~mottelet
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

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


More information about the users mailing list