Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Circshift applied to columns by different amounts
Date: Sat, 17 Mar 2012 03:43:11 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 11
Message-ID: <jk118f$np4$1@newscl01ah.mathworks.com>
References: <b4d6be8b-3520-4e7b-8d44-726651eddcd4@g2g2000vbs.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1331955791 24356 172.30.248.47 (17 Mar 2012 03:43:11 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 17 Mar 2012 03:43:11 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:761277

Tyler <hayes.tyler@gmail.com> wrote in message <b4d6be8b-3520-4e7b-8d44-726651eddcd4@g2g2000vbs.googlegroups.com>...
> .......
> and I need to have it each column shift down by the number of NaNs in
> that column yielding:
> ......
- - - - - - - - - - -
 [m,n] = size(a1);
 [I,J] = ndgrid(0:m-1,0:n-1);
 a1new = a1(1+m*J+mod(bsxfun(@minus,I,sum(isnan(a1),1)),m));

Roger Stafford