From: Bruno Luong on 14 Mar 2010 05:59 "james bejon" <jamesbejon(a)yahoo.co.uk> wrote in message <hni85h$ddd$1(a)fred.mathworks.com>... > I'm therefore expecting a (10 x n) output matrix n = 4; data=rand(30,n) indices = repmat((1:10)', 3, 1); [I J] = ndgrid(indices,1:n); accumarray([I(:) J(:)],data(:),[10 n]) Bruno
From: Oleg Komarov on 14 Mar 2010 08:17 "james bejon" > I'm therefore expecting a (10 x n) output matrix I assumed you wanted a 10 by 1 output in my answer. Try Bruno's solution. Oleg
From: james bejon on 15 Mar 2010 18:08
That's just what I'm after. Thanks very much, Bruno. |