[go: up one dir, main page]

Menu

[73c35b]: / anal / wind.m  Maximize  Restore  History

Download this file

19 lines (18 with data), 549 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
% wind.m: the index function of a subset x of a vector y of the same type;
% GUISDAP v.1.60 96-05-27 Copyright Asko Huuskonen and Markku Lehtinen
%
% y is supposed to consist of distinct elements. The output is a row
% vector.
%
% z=wind(x,y)
function [z,zz]=wind(x,y)
z=[];zz=[];
sy=sort(col(y));dsy=diff(sy);
sx=sort(col(x));dsx=diff(sx);
if ~isempty(dsy) && isempty(dsy==0), error('GUISDAP:wind','y not an index'), end
if length(x)>length(y), error('GUISDAP:wind','wrong order'), end
for i=row(x)
w=find(y==i);
z=[z w];
zz=[zz w(1)];
end