This is a static copy of a profile report

Home

imagesci/private/writepng>parseInputs (Calls: 10, Time: 0.024 s)
Generated 16-Jul-2020 17:09:40 using performance time.
subfunction in file /Applications/MATLAB_R2020a.app/toolbox/matlab/imagesci/private/writepng.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
imagesci/private/writepngfunction10
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
349
p.parse(varargin{:});
100.005 s22.3%
351
unmatched = p.Unmatched;
100.001 s6.1%
321
p = inputParser;
100.001 s6.0%
325
p.addParameter('bitdepth',[], ...
100.001 s4.1%
350
results = p.Results;
100.001 s3.3%
All other lines  0.014 s58.2%
Totals  0.024 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...,'string'},{'nonempty','scalartext'})anonymous function200.001 s3.4%
...teattributes(x,{'double'},{'scalar'})anonymous function200.001 s3.3%
...har','double','string'},{'nonempty'})anonymous function100.001 s2.2%
Self time (built-ins, overhead, etc.)  0.022 s91.1%
Totals  0.024 s100% 
Code Analyzer results
Line numberMessage
Coverage results
Show coverage for parent directory
Total lines in function65
Non-code lines (comments, blank lines)18
Code lines (lines that can run)47
Code lines that did run43
Code lines that did not run4
Coverage (did run/can run)91.49 %
Function listing
time 
Calls 
 line
 287 
function [results, unmatched] = parseInputs(data,map,filename,varargin)
 288 

 289 
% Validate required arguments
< 0.001 
     10 
 290
validateattributes(data,{'double','single','logical','uint8','uint16'},{'nonempty'}); 
< 0.001 
     10 
 291
if isempty(map) 
< 0.001 
     10 
 292
    validateattributes(map,{'double'},{}); 
 293 
else
 294 
    validateattributes(map,{'double'},{'2d','ncols',3,'>=',0,'<=',1});
< 0.001 
     10 
 295
end 
< 0.001 
     10 
 296
validateattributes(filename,{'char', 'string'},{'nonempty', 'scalartext'}); 
 297 

< 0.001 
     10 
 298
propStrings = {'interlacetype', 'imagemodtime', ... 
 299 
    'transparency', 'bitdepth', 'significantbits', 'alpha', ...
 300 
    'background',   'gamma',    'xresolution',     'chromaticities', ...
 301 
    'yresolution',  'title',    'author',          'resolutionunit', ...
 302 
    'description',  'source',   'software',        'creationtime',  ...
 303 
    'disclaimer',   'warning',  'copyright',       'comment' };
 304 

 305 
% Process varargin into a form that we can use with the input parser.
< 0.001 
     10 
 306
for k = 1:2:length(varargin) 
< 0.001 
     50 
 307
    prop = lower(varargin{k}); 
< 0.001 
     50 
 308
    if (~ischar(prop)) 
 309 
        error(message('MATLAB:imagesci:writepng:parameterNotString'));
< 0.001 
     50 
 310
    end 
 311 
    
< 0.001 
     50 
 312
    idx = find(strncmp(prop, propStrings, numel(prop))); 
< 0.001 
     50 
 313
    if (length(idx) > 1) 
 314 
        error(message('MATLAB:imagesci:validate:ambiguousParameterName', prop));
< 0.001 
     50 
 315
    elseif isscalar(idx) 
< 0.001 
     50 
 316
        varargin{k} = propStrings{idx}; 
< 0.001 
     50 
 317
    end 
< 0.001 
     50 
 318
end 
 319 

 320 
% Define the parser
  0.001 
     10 
 321
p = inputParser; 
< 0.001 
     10 
 322
p.KeepUnmatched = true; 
 323 

 324 
% Add PV pairs to the input parser
< 0.001 
     10 
 325
p.addParameter('bitdepth',[],       @(x)validateattributes(x,{'double'},{'scalar'})); 
< 0.001 
     10 
 326
p.addParameter('significantbits',[],@(x)validateattributes(x,{'double'},{'nonempty','>=',1})); 
< 0.001 
     10 
 327
p.addParameter('transparency',[],   @(x)validateattributes(x,{'double'},{'>=',0,'<=',1})); 
< 0.001 
     10 
 328
p.addParameter('alpha',[],          @(x)validateattributes(x,{'double','uint8','uint16'},{'size',[size(data,1) size(data,2)]})); 
< 0.001 
     10 
 329
p.addParameter('background',[],     @(x)validateattributes(x,{'char','double','string'},{'row','nonempty'})); 
< 0.001 
     10 
 330
p.addParameter('gamma',[],          @(x)validateattributes(x,{'double'},{'scalar','>=',0})); 
< 0.001 
     10 
 331
p.addParameter('chromaticities',[], @(x)validateattributes(x,{'double'},{'row','numel',8,'>=',0,'<=',1})); 
< 0.001 
     10 
 332
p.addParameter('xresolution',[],    @(x)validateattributes(x,{'double'},{'scalar'})); 
< 0.001 
     10 
 333
p.addParameter('yresolution',[],    @(x)validateattributes(x,{'double'},{'scalar'})); 
< 0.001 
     10 
 334
p.addParameter('title',[],          @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 335
p.addParameter('author',[],         @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 336
p.addParameter('description',[],    @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 337
p.addParameter('copyright',[],      @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 338
p.addParameter('software',[],       @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 339
p.addParameter('disclaimer',[],     @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 340
p.addParameter('warning',[],        @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 341
p.addParameter('source',[],         @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 342
p.addParameter('comment',[],        @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 343
p.addParameter('creationtime',[],   @(x)validateattributes(x,{'char','double', 'string'},{'nonempty'})); 
< 0.001 
     10 
 344
p.addParameter('imagemodtime',[],   @(x)validateattributes(x,{'char','double', 'string'},{'nonempty'})); 
< 0.001 
     10 
 345
p.addParameter('interlacetype','none', @(x) validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
< 0.001 
     10 
 346
p.addParameter('resolutionunit',[], @(x)validateattributes(x,{'char', 'string'},{'nonempty', 'scalartext'})); 
 347 

 348 
% Parse remaining arguments and return results and unmatched
  0.005 
     10 
 349
p.parse(varargin{:}); 
< 0.001 
     10 
 350
results = p.Results; 
  0.001 
     10 
 351
unmatched = p.Unmatched; 

Other subfunctions in this file are not included in this listing.