function [intf,begin,endd,gravity,maxim,compac,target]=dt_read(name,frames,P); %Syntax: [intf,begin,endd,gravity,maxim,compac,target]=dt_read(name,frames,P); % or: [intf,begin,endd,gravity,maxim,compac,target]=dt_read(name,frames); % % Function for reading file of imterpol functions and targets from Frederic's % phi-file % % name - name of file (xxx.phi) % frames - number of frames (important !) % P - size of parameters vectors. Optional - default 10. % begin - column vector (length N) of beginnings of interp. functions. % endd - column vector (length N) of ends of interp. functions. % gravity - column vector (length N) of gravity centers % maxim - column vector (length N) of maxima locations % intf - matrix (N, frames ) with interpolation functions on the lines % compac - column vector (length N) of compacities of interpol functions % target - matrix (P, N) with target vectors in columns. if nargin==2, P=10; end fil=fopen (name, 'r'); begin=[]; endd=[]; gravity=[]; maxim=[]; intf=[]; compac=[]; cnt=0; while 1, [b,e,gr,m,ifu,cc,targ]=dt_phi(fil,P); if b==-1, % nothing more in input file break end %%% one item read, modify the output values begin=[begin; b]; endd=[endd; e]; gravity=[gravity; gr]; maxim=[maxim; m]; % interpolation function must be placed where it belongs. ifuline=zeros(1,frames); ifuline(b:e) = ifu; % [b e] % plot(ifuline); pause intf=[intf; ifuline]; % target is column vector target=[target targ]; % cnt % cnt=cnt+1; end plot(1:frames, intf); fclose(fil);