function r=edit(fn1, fn2, fn3) %EDIT Call the selected editor to edit the file. % % EDIT [FNAME] [FNAME] [FNAME] % % If the extension is not specified, .m will be % add to the filename. % EDIT accept until 3 file names but this depends % on the capability of the selected editor. % The default Editor is emacs. % You can use another editor setting the enviromental % variable MATLAB_EDITOR in your .cshrc % % Return 0 is if the command was correctly executed. % Returns a nonzero value in s to indicate failure % of the command. % % See also KEDIT, SETENV (Unix command). % % Claudio 16 August 1994 % % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % Editor = getenv('MATLAB_EDITOR'); sp=' '; % Set the default editor in case MATLAB_EDITOR is not defined. if isempty(Editor) Editor = 'emacs'; end if nargin > 3 error('Too many input arguments.'); end if nargin > 0; if isempty(find(fn1 == '.')) fn1=[fn1, '.m']; end else fn1=[]; end if nargin > 1 if isempty(find(fn2 == '.')) fn2=[fn2, '.m']; end else fn2=[]; end if nargin > 2 if isempty(find(fn3 == '.')) fn3=[fn3, '.m']; end else fn3=[]; end filenames = [fn1,sp,fn2,sp,fn3]; command=[Editor, sp, filenames, sp, '&']; rr=unix(command); if nargout==1 r=rr end return