[Scilab-users] Vector from tlist?
Stefan Du Rietz
sdr at durietz.se
Wed Jun 12 15:19:57 CEST 2013
Thank you Serge, but list2vec uses a loop.
In my simple case, this is perhaps better:
// get an ordinary list by removing the first element:
handles_list = handles_tlist;
handles_list(1) = null();
handles_vec = [];
// put one handle at a time in the vector
for h = handles_list
handles_vec = [handles_vec; h];
end
// If I want to delete all handles in the list, I can then do:
delete(handles_vec)
But if I anyhow have to use a loop (and don't need the list any more),
I can do it like this (where handles_list is the tlist):
handles_list(1) = null();
for h = handles_list
delete(h)
end
Which solution is faster?
Stefan
On 2013-06-12 13:55, Serge Steer wrote:
--------------------
> You can look at list2vec, but it only work with list not tlist
>
> Serge
> Le 12/06/2013 11:45, Stefan Du Rietz a écrit :
>> No, I have a tlist with elements 2:$ of the same type (graphic
>> handles) and I want them in a vector.
>>
>> Stefan
>>
>> On 2013-06-12 11:33, Carrico, Paul wrote:
>> --------------------
>>> The example hereafter is what you are expecting ?
>>>
>>> ##############################
>>> A = rand(10,1)
>>> index=find(A >= 0.5)
>>> C=A(index)
>>>
>>>
>>> Paul
>>>
>>> -----Message d'origine-----
>>> De : users-bounces at lists.scilab.org
>>> [mailto:users-bounces at lists.scilab.org] De la part de Stefan Du Rietz
>>> Envoyé : mercredi 12 juin 2013 11:30
>>> À : [scilab-Users]
>>> Objet : [Scilab-users] Vector from tlist?
>>>
>>> Hello,
>>> is it possible to extract elements (of the same type) from a list into
>>> a vector without use of a loop?
>>>
>>> Regards
>>> Stefan
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>> --------------------------------------------------------------------------------
>>>
>>>
>>>
>>> Le présent mail et ses pièces jointes sont confidentiels et
>>> destinés à la personne ou aux personnes visée(s) ci-dessus. Si vous
>>> avez reçu cet e-mail par erreur, veuillez contacter immédiatement
>>> l'expéditeur et effacer le message de votre système. Toute
>>> divulgation, copie ou distribution de cet e-mail est strictement
>>> interdite.
>>>
>>> This email and any files transmitted with it are confidential and
>>> intended solely for the use of the individual or entity to whom
>>> they are addressed. If you have received this email in error,
>>> please contact the sender and delete the email from your system. If
>>> you are not the named addressee you should not disseminate,
>>> distribute or copy this email.
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>>
>
>
More information about the users
mailing list