Code covered by the BSD License  

Highlights from
slatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[j4saveresult,iwhich,ivalue,iset]=j4save(iwhich,ivalue,iset);
function [j4saveresult,iwhich,ivalue,iset]=j4save(iwhich,ivalue,iset);
j4saveresult=[];
persistent iparam j4save ; 

if isempty(j4saveresult), j4saveresult=0; end;
%***BEGIN PROLOGUE  J4SAVE
%***SUBSIDIARY
%***PURPOSE  Save or recall global variables needed by error
%            handling routines.
%***LIBRARY   SLATEC (XERROR)
%***TYPE      INTEGER (J4SAVE-I)
%***KEYWORDS  ERROR MESSAGES, ERROR NUMBER, RECALL, SAVE, XERROR
%***AUTHOR  Jones, R. E., (SNLA)
%***DESCRIPTION
%
%     Abstract
%        J4SAVE saves and recalls several global variables needed
%        by the library error handling routines.
%
%     Description of Parameters
%      --Input--
%        IWHICH - Index of item desired.
%                = 1 Refers to current error number.
%                = 2 Refers to current error control flag.
%                = 3 Refers to current unit number to which error
%                    messages are to be sent.  (0 means use standard.)
%                = 4 Refers to the maximum number of times any
%                     message is to be printed (as set by XERMAX).
%                = 5 Refers to the total number of units to which
%                     each error message is to be written.
%                = 6 Refers to the 2nd unit for error messages
%                = 7 Refers to the 3rd unit for error messages
%                = 8 Refers to the 4th unit for error messages
%                = 9 Refers to the 5th unit for error messages
%        IVALUE - The value to be set for the IWHICH-th parameter,
%                 if ISET is true .
%        ISET   - If ISET=true, the IWHICH-th parameter will BE
%                 given the value, IVALUE.  If ISET=false, the
%                 IWHICH-th parameter will be unchanged, and IVALUE
%                 is a dummy parameter.
%      --Output--
%        The (old) value of the IWHICH-th parameter will be returned
%        in the function value, J4SAVE.
%
%***SEE ALSO  XERMSG
%***REFERENCES  R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
%                 Error-handling Package, SAND82-0800, Sandia
%                 Laboratories, 1982.
%***ROUTINES CALLED  (NONE)
%***REVISION HISTORY  (YYMMDD)
%   790801  DATE WRITTEN
%   891214  Prologue converted to Version 4.0 format.  (BAB)
%   900205  Minor modifications to prologue.  (WRB)
%   900402  Added TYPE section.  (WRB)
%   910411  Added KEYWORDS section.  (WRB)
%   920501  Reformatted the REFERENCES section.  (WRB)
%***end PROLOGUE  J4SAVE
if isempty(iparam), iparam([1:9]) =[0,2,0,10,5,0,0,0,0]; end;
%!!      INTEGER iparam(9)
%!!      SAVE iparam
%!!      DATA iparam(1) , iparam(2) , iparam(3) , iparam(4)/0 , 2 , 0 , 10/
%!!      DATA iparam(5)/1/
%!!      DATA iparam(6) , iparam(7) , iparam(8) , iparam(9)/0 , 0 , 0 , 0/
%***FIRST EXECUTABLE STATEMENT  J4SAVE
j4saveresult = fix(iparam(iwhich));
if( iset )
iparam(iwhich) = fix(ivalue);
end;
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',iwhich); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',ivalue); evalin('caller',[inputname(2),'=FUntemp;']); end
if csnil&&~isempty(inputname(3)), assignin('caller','FUntemp',iset); evalin('caller',[inputname(3),'=FUntemp;']); end
end
%DECK JAIRY

Contact us at files@mathworks.com