function []= toolbox_hack(mdir,newdir,prefix,postfix)
% [] = toolbox_hack(mdir,newdir,prefix,postfix)
% Reads the TOTAL MATLAB code in an m-file and
% replaces the call to other m-files in every location in the text to
% a m-file name with the new pre- and postfixes.
%
% INPUT PARAMETERS
%
% mdir = directory containing the
% m-files in the toolbox you want to crosslink
% newdir = directory name containing all the new m-files
% prefix = a string which is used as a prefix to m-file name
% postfix = a string which is used as a postfix to m-file name
%
% Copyright (c) B.K. Alsberg, 1997
%
%warning off
[C,G2,M] = crossref(mdir);
[n,m]=size(C);
% Removing self-references:
C = C -eye(n);
%%%%%%%%%%%%% Going into each m file %%%%%%%%%%%%%%%%%
for i =1:n
i
filename = deblank(G2(i,:))
ref1 = find(C(i,:)==1);
ref2 = (find(C(:,i)==1))';
%filename1 = [mdir,'\',filename];
% Creating the string matrices containing
% names to other m-files called or calling
% current file:
ref_to = M(ref1,:);
to_ref = M(ref2,:);
matref_write(filename,mdir,newdir,ref_to,prefix,postfix);
end;