s-news
[Top] [All Lists]

Filling a vector at some places

To: <s-news@lists.biostat.wustl.edu>
Subject: Filling a vector at some places
From: <Andre.Mery@aventis.com>
Date: Wed, 29 Sep 2004 13:33:37 +0200
Thread-index: AcSmGCk0NXdVxCVzS1mynUdFXNwKtQ==
Thread-topic: Filling a vector at some places
Hi,
 
I am stuck by the following problem.
 
I have a vector with 36 positions, all set to 0:
vec1 =  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Now, after some other calculations, I get a the vector:
vec2 = 18  1  5  2
And so, I want to transform the vec1 to a vec3:
 vec3 =  1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
where 1s appear at the places indicated by vec2 (places # 1, 2, 5 and 18)
I can't find a simple way to do so. Can anyone enlighten me ?
 
 
 

André Méry
Aventis Pharma
20, avenue Raymond Aron - 92160 Antony
[Courrier / Mail : Tri B2/13]
[Tél. / Tel. : 01 55 71 68 69]

 
<Prev in Thread] Current Thread [Next in Thread>