Path: news.mathworks.com!not-for-mail
From: "Thomas " <thomas.seers@postgrad.manchester.ac.uk>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Problem using horzcat with index vectors in a for loop
Date: Mon, 21 Jan 2013 22:09:09 +0000 (UTC)
Organization: Univ of Manchester
Lines: 8
Message-ID: <kdkea4$rqc$1@newscl01ah.mathworks.com>
References: <kdhu6v$o6p$1@newscl01ah.mathworks.com>
Reply-To: "Thomas " <thomas.seers@postgrad.manchester.ac.uk>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1358806149 28492 172.30.248.48 (21 Jan 2013 22:09:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 21 Jan 2013 22:09:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3752776
Xref: news.mathworks.com comp.soft-sys.matlab:787033

Update: the problem was a syntax error: it should have read:

for k=1:length(x)
    desired(k,:) = vertcat(repmat(x(k), ind(k),1),repmat(null, col-ind(k),1))';
end

This gives the correct output. 
Thomas