Home > p2plib > setfn.m

setfn

PURPOSE ^

set filenames according to name of p or varargin

SYNOPSIS ^

function [p,ok]=setfn(p,varargin)

DESCRIPTION ^

 set filenames according to name of p or varargin

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [p,ok]=setfn(p,varargin) 
0002 % set filenames according to name of p or varargin
0003 ok=1;
0004 if isempty(varargin); pre=sprintf('%s',inputname(1)); 
0005 else pre=varargin{1}; end 
0006 if ~exist(pre,'dir'); 
0007     mkdir(pre); fprintf('creating directory %s\n',pre);
0008 else ~isempty(p); % avoid error for empty p
0009     if p.dirchecksw==1 % check that points don't get overwritten!
0010        mlab=max(getlabs(pre));if isempty(mlab); mlab=0; end
0011        if (mlab>p.count) && ...
0012                (asknu(['warning: labels in ' pre ' are > current label ' ...
0013                mat2str(p.count) '. Continue? '],1)~=1) 
0014            ok=0; return;
0015        end
0016     end
0017 end
0018 p.pre = pre; p.pname=[pre '/p']; p.bpname=[pre '/bp']; 
0019 p.branch=[];p.bcount=1; p.count=1;

Generated on Wed 15-Aug-2012 10:09:15 by m2html © 2005