http://www.mathworks.ch/matlabcentral/newsreader/view_thread/156659
% the data
v=1:7;
w=[0,0,0];
pos=[3,6,9];
% the engine
tf=false(1,numel(v)+numel(w));
r=double(tf);
tf(pos)=true;
r(tf)=w;
r(~tf)=v;
% the result
r
>> B = reshape(A, 2, 6/2)
B =
1 4 6
3 5 7
>> B = cat(1,B, sparse(1,6/2))
B =
(1,1) 1
(2,1) 3
(1,2) 4
(2,2) 5
(1,3) 6
(2,3) 7
>> B = reshape(B, [], 1 )
B =
(1,1) 1
(2,1) 3
(4,1) 4
(5,1) 5
(7,1) 6
(8,1) 7
>> full(B)
ans =
1
3
0
4
5
0
6
7
0
"Diego Lass" <dlIS...@gmail.com> wrote in message <h1ucbh$f5i$1...@fred.mathworks.com>...