Cross-linked m-file

crossref.m

Located in:

C:\BKA\MTOOLS\TOOLBOX\HTMLTOOL\TST


Function call

[C,G2,M] = crossref(currdirec,[direc])


Function comments

 
% Finds the cross reference matrix between all the 
% m-files in directories direc and currdirec. Dir has dimension 
% [k x m] where k=number of directories and m=max no. 
% of string elements to keep the longest dir name 
% Sometimes we are only interested in the cross-references 
% between m-files within currdirec, that is why direc 
% is optional. currdirect is a VECTOR. 
% If only currdir then G2=M. 
% 


m-files that call crossref.m


All the cross references in the source m-code of crossref.m

 
function [C,G2,M] = crossref(currdirec,direc) 
% [C,G2,M] = crossref(currdirec,[direc]) 
% Finds the cross reference matrix between all the 
% m-files in directories direc and currdirec. Dir has dimension 
% [k x m] where k=number of directories and m=max no. 
% of string elements to keep the longest dir name 
% Sometimes we are only interested in the cross-references 
% between m-files within currdirec, that is why direc 
% is optional. currdirect is a VECTOR. 
% If only currdir then G2=M. 
% 
 
if nargin ==2 
 [dd,m]=size(direc); 
 for i = 1:dd 
   G = diread(direc(i,:),' ','m'); 
   M = [M;G]; 
 end; 
end; 
 
  G2 = diread(currdirec,' ','m'); 
  M = [M;G2]; 
 
[n1,m1]=size(G2); 
[n2,m2]=size(M); 
 
C = zeros(n1,n2); 
 
 for j =1:n1 
  filename = deblank(G2(j,:)); 
  disp(['Checking file ',filename]); 
   for k =1:n2 
      fid = fopen([currdirec,'\',filename],'r'); 
      word = lower(deblank(M(k,:))); 
      word = word(1:length(word)-2); 
      s = lower(fscanf(fid,'%s')); 
      res = findstr(s,word); 
       
       if length(res) >0 
         C(j,k) = 1; 
       end; 
      fclose(fid); 
   end; 
 end; 
 
 
 
 


Written by B.K. Alsberg 10:7 16/1 1997

E-mail:bka@aber.ac.uk