loadSamples

PURPOSE ^

loadSamples Load a set of sampled data points

SYNOPSIS ^

function samples = loadSamples(filename, numFiles, pointsPerFile,numSkipped,randPts)

DESCRIPTION ^

loadSamples Load a set of sampled data points

 samples = loadSamples(filename,numFiles,pointsPerFile,numSkipped,randPts)

INPUTS
 filename          The name of the files containing the sample points.
 numFiles          The number of files containing the sample points.
 pointsPerFile     The number of points to be taken from each file.

OPTIONAL INPUTS
 numSkipped        Number of files skipped (default = 0)
 randPts           Select random points from each file (true/false, default = false)

OUTPUT
 samples           Sample flux distributions

Written by Gregory Hannum and Markus Herrgard 8/17/05.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function samples = loadSamples(filename, numFiles, pointsPerFile,numSkipped,randPts)
0002 %loadSamples Load a set of sampled data points
0003 %
0004 % samples = loadSamples(filename,numFiles,pointsPerFile,numSkipped,randPts)
0005 %
0006 %INPUTS
0007 % filename          The name of the files containing the sample points.
0008 % numFiles          The number of files containing the sample points.
0009 % pointsPerFile     The number of points to be taken from each file.
0010 %
0011 %OPTIONAL INPUTS
0012 % numSkipped        Number of files skipped (default = 0)
0013 % randPts           Select random points from each file (true/false, default = false)
0014 %
0015 %OUTPUT
0016 % samples           Sample flux distributions
0017 %
0018 %Written by Gregory Hannum and Markus Herrgard 8/17/05.
0019 
0020 if (nargin < 4)
0021     numSkipped = 0;
0022 end
0023 if (nargin < 5)
0024     randPts = false;
0025 end
0026 
0027 samples = [];
0028 
0029 h = waitbar(0,'Loading samples ...');
0030 %load points from the files into pset
0031 for i = 1:numFiles
0032     if (i > numSkipped)
0033         
0034         data = load([filename '_' num2str(i) '.mat']);
0035         selPoints = any(data.points ~= 0);
0036         numPoints = sum(selPoints);        
0037         if (randPts)
0038           % Pick a random set of points
0039             pointInd = randperm(numPoints);
0040             samples = [samples data.points(:,pointInd(1:pointsPerFile))];
0041         else
0042           % Pick points at regular intervals
0043             pSkip = max([floor(numPoints/pointsPerFile) 1]);
0044             samples = [samples data.points(:,1:pSkip:numPoints)];
0045         end
0046         waitbar((i-numSkipped)/(numFiles-numSkipped),h);
0047     end
0048 end
0049 close(h);

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003