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 slfiltertext
Home > sltoolbox > text > slfiltertext.m

slfiltertext

PURPOSE ^

SLFILTERTEXT Processes the lines of text

SYNOPSIS ^

function Tf = slfiltertext(T, f, varargin)

DESCRIPTION ^

SLFILTERTEXT Processes the lines of text

 $ Syntax $
   - Tf = slfiltertext(T, f, ...)

 $ Arguments $
   - T:        the text to be filtered
   - f:        the filter function
   - Tf        the filtered text

 $ Description $
   - Tf = slfiltertext(T, f, ...) processes (filters) every line
     of the text T, in form of cell array of strings, and generated the
     cell array of processed text Tf. the filtering is run as
           filtered_line = f(source_line, ...)

 $ Remarks $
   - You can specify f as empty, then the original text will be simply
     returned without processing

 $ History $
   - Created by Dahua Lin, on Aug 9th, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
This function is called by:

SOURCE CODE ^

0001 function Tf = slfiltertext(T, f, varargin)
0002 %SLFILTERTEXT Processes the lines of text
0003 %
0004 % $ Syntax $
0005 %   - Tf = slfiltertext(T, f, ...)
0006 %
0007 % $ Arguments $
0008 %   - T:        the text to be filtered
0009 %   - f:        the filter function
0010 %   - Tf        the filtered text
0011 %
0012 % $ Description $
0013 %   - Tf = slfiltertext(T, f, ...) processes (filters) every line
0014 %     of the text T, in form of cell array of strings, and generated the
0015 %     cell array of processed text Tf. the filtering is run as
0016 %           filtered_line = f(source_line, ...)
0017 %
0018 % $ Remarks $
0019 %   - You can specify f as empty, then the original text will be simply
0020 %     returned without processing
0021 %
0022 % $ History $
0023 %   - Created by Dahua Lin, on Aug 9th, 2006
0024 %
0025 
0026 %% parse and verify arguments
0027 
0028 if nargin < 2
0029     raise_lackinput('slfiltertext', 2);
0030 end
0031 
0032 
0033 %% filter
0034 if ~isempty(T)
0035     if ~isempty(f)
0036         nlines = length(T);
0037         Tf = cell(nlines, 1);
0038         for i = 1 : nlines            
0039             curline = T{i};            
0040             procline = feval(f, curline, varargin{:});
0041             Tf{i} = procline;            
0042         end
0043     else
0044         Tf = T;
0045     end
0046 else
0047     Tf = {};
0048 end
0049 
0050 
0051

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

Contact us at files@mathworks.com