Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of isattached
Home > sltoolbox > fileio > @sllog > isattached.m

isattached

PURPOSE ^

ISATTACHED Judges whether the file is attached to the logger

SYNOPSIS ^

function [tf, idx] = isattached(logger, filename)

DESCRIPTION ^

ISATTACHED Judges whether the file is attached to the logger

 $ Syntax $
   - [tf, idx] = isattached(logger, filename)

 $ Arguments $
   - logger:       the logger to be queried
   - filename:     the filename to be queried
   - tf:           the boolean variable indicating whether attach
   - idx:          the index of the found file

 $ Description $
   - [tf, idx] = isattached(logger, filename) judges whether a file
     is currently attached to the logger. The filename should be 
     given as relative path to the logger's root path.

 $ History $
   - Created by Dahua Lin, on Aug 12nd, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • sladdpath SLADDPATH Adds dirpath to precede the filenames
This function is called by:
  • addfiles ADDFILES add a set of log files to the logger
  • detachfiles DETACHFILES Detachs the logger from some added files
  • isactive ISACTIVE Queries whether a log file is active
  • setactive SETACTIVE Sets a set of files active/inactive

SOURCE CODE ^

0001 function [tf, idx] = isattached(logger, filename)
0002 %ISATTACHED Judges whether the file is attached to the logger
0003 %
0004 % $ Syntax $
0005 %   - [tf, idx] = isattached(logger, filename)
0006 %
0007 % $ Arguments $
0008 %   - logger:       the logger to be queried
0009 %   - filename:     the filename to be queried
0010 %   - tf:           the boolean variable indicating whether attach
0011 %   - idx:          the index of the found file
0012 %
0013 % $ Description $
0014 %   - [tf, idx] = isattached(logger, filename) judges whether a file
0015 %     is currently attached to the logger. The filename should be
0016 %     given as relative path to the logger's root path.
0017 %
0018 % $ History $
0019 %   - Created by Dahua Lin, on Aug 12nd, 2006
0020 %
0021 
0022 tf = false;
0023 idx = 0;
0024 
0025 if ~isempty(logger.files)
0026     
0027     fp = sladdpath(filename, logger.rootpath);
0028     
0029     n = length(logger.files);
0030     for i = 1 : n        
0031         if strcmpi(fp, logger.files(i).filepath)
0032             tf = true;
0033             idx = i;
0034             break;
0035         end        
0036     end
0037     
0038 end

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com