Path: news.mathworks.com!not-for-mail
From: "us " <us@neurol.unizh.ch>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Inserting elements in a vector
Date: Mon, 24 Sep 2007 15:51:31 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 19
Message-ID: <fd8me3$kek$1@fred.mathworks.com>
References: <1190647649.920687.281800@o80g2000hse.googlegroups.com>
Reply-To: "us " <us@neurol.unizh.ch>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1190649091 20948 172.30.248.37 (24 Sep 2007 15:51:31 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 24 Sep 2007 15:51:31 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:429948


somdeb:
<SNIP vec acrobatics...

one of the many solutions

% the data
     v=1:10;
     w=[-10,-20,-30];
     pos=[2,6,7];
% the engine
     tf=false(1,numel(v)+numel(w));
     r=double(tf);
     tf(pos)=true;
     r(tf)=w;
     r(~tf)=v;
% the result
     r

us