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 construct_dataset_filenames
Home > sltoolbox > ExpDL > @dataset > construct_dataset_filenames.m

construct_dataset_filenames

PURPOSE ^

CONSTRUCT_DATASET_FNS Constructs Dataset object from filenames

SYNOPSIS ^

function ds = construct_dataset_fns(ds, name, format, filenames, labels)

DESCRIPTION ^

CONSTRUCT_DATASET_FNS Constructs Dataset object from filenames

 $ Syntax $
   - ds = construct_dataset_fns(ds, name, format, filenames, labels)

 $ Arguments $
   - name:             the name of the dataset
   - format:           the format of file samples
   - filenames:        the filenames of the image samples
   - labels:           the labels of the corresponding samples
   - ds:               the constructed object

 $ Description $
   - ds = construct_dataset_fns(name, format, filenames, labels) 
     constructs a dataset object from filenames and corresponding labels 
     identifying the class of the samples.

 $ Remarks $
   - The dataset object will be constructed as sample set.

 $ History $
   - Created by Dahua Lin on Jul 26th, 2005

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:
  • dataset DATASET Constructs a dataset object (conform to DSDML)

SOURCE CODE ^

0001 function ds = construct_dataset_fns(ds, name, format, filenames, labels)
0002 %CONSTRUCT_DATASET_FNS Constructs Dataset object from filenames
0003 %
0004 % $ Syntax $
0005 %   - ds = construct_dataset_fns(ds, name, format, filenames, labels)
0006 %
0007 % $ Arguments $
0008 %   - name:             the name of the dataset
0009 %   - format:           the format of file samples
0010 %   - filenames:        the filenames of the image samples
0011 %   - labels:           the labels of the corresponding samples
0012 %   - ds:               the constructed object
0013 %
0014 % $ Description $
0015 %   - ds = construct_dataset_fns(name, format, filenames, labels)
0016 %     constructs a dataset object from filenames and corresponding labels
0017 %     identifying the class of the samples.
0018 %
0019 % $ Remarks $
0020 %   - The dataset object will be constructed as sample set.
0021 %
0022 % $ History $
0023 %   - Created by Dahua Lin on Jul 26th, 2005
0024 %
0025 
0026 %% parse and verify input arguments
0027 
0028 N = length(filenames);
0029 if length(labels) ~= N
0030     error('The length of labels is not consistent with that of filenames');
0031 end
0032 
0033 %% construct
0034 
0035 ds.version = '1.00';
0036 ds.name = name;
0037 ds.unittype = 'Sample';
0038 ds.format = format;
0039 ds.author = 'unknown';
0040 ds.description = 'generated by construct_dataset_fns.m';
0041 ds.attribs = [];
0042 
0043 ds.units = [];
0044 
0045 for i = 1 : N;
0046     ds.units(i).class_id = labels(i);
0047     ds.units(i).filename = filenames{i};
0048     ds.units(i).attribs = [];
0049 end
0050 
0051 
0052 
0053 
0054

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

Contact us at files@mathworks.com