source: misclib/shiftind.m @ 40

Last change on this file since 40 was 40, checked in by tjniskan, 11 years ago
  • Rewrote the handling of the old SUR and MRI formats

(an2_smiswrite.m,an2_smisread.m). Consider this as "legacy support"...

  • Removed depricated functions write_mri.m, an2_surread.m and

an2_mriread.m

  • Now (hopefully) the name change is complete and all the license

issues are resolved...

A an2_smiswrite.m
M misclib/spectrsum.m
M misclib/shiftind.m
M misclib/nifti4dto3d.m
M misclib/nifti3dto4d.m
M misclib/dcm_info.m
M misclib/addicon.m
M misclib/makelcmraw.m
M an2_revision.m
D write_mri.m
M an2_data_read.m
D an2_surread.m
A an2_smisread.m
M aedes.m
D an2_mriread.m

File size: 1022 bytes
Line 
1function ind = shiftind(data,shift)
2% SHIFTIND -
3%   
4%
5% Synopsis:
6%
7% Description:
8%
9% Examples:
10%
11% See also:
12%
13
14% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
15%
16% Department of Physics, (or Department of Neurobiology)
17% University of Kuopio, FINLAND
18%
19% This program may be used under the terms of the GNU General Public
20% License version 2.0 as published by the Free Software Foundation
21% and appearing in the file LICENSE.TXT included in the packaging of
22% this program.
23%
24% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26
27if length(data)==1
28  ind = 1:data;
29  dataLength = length(ind);
30else
31  ind = 1:length(data);
32  dataLength = length(data);
33end
34
35if shift==0 % No shifting required
36  return
37elseif shift>0 % Shift right
38  ind = [(shift+1):-1:2 1:dataLength-shift];
39elseif shift<0 % Shift left
40  shift = abs(shift);
41  ind = [(shift+1):dataLength dataLength-1:-1:dataLength-shift];
42end
Note: See TracBrowser for help on using the repository browser.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008