This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
imwritefunction10
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
637
fmt_s = imformats(varargin{fir...
100.008 s64.1%
642
paramPairs = varargin((firstSt...
100.001 s4.2%
596
if (ischar(varargin{k}))
200.000 s3.0%
657
validateattributes(paramPairs{...
500.000 s2.8%
658
end
500.000 s2.7%
All other lines  0.003 s23.3%
Totals  0.012 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
imformatsfunction100.007 s57.7%
Self time (built-ins, overhead, etc.)  0.005 s42.3%
Totals  0.012 s100% 
Code Analyzer results
Line numberMessage
584The value assigned to variable 'data' might be unused.
586The value assigned to variable 'filename' might be unused.
Coverage results
Show coverage for parent directory
Total lines in function79
Non-code lines (comments, blank lines)25
Code lines (lines that can run)54
Code lines that did run37
Code lines that did not run17
Coverage (did run/can run)68.52 %
Function listing
time 
Calls 
 line
 582 
function [data, map, filename, format, paramPairs] = parse_inputs(varargin)
 583 

< 0.001 
     10 
 584
data = []; 
< 0.001 
     10 
 585
map = []; 
< 0.001 
     10 
 586
filename = ''; 
< 0.001 
     10 
 587
format = ''; 
< 0.001 
     10 
 588
paramPairs = {}; 
 589 

< 0.001 
     10 
 590
if (nargin < 2) 
 591 
	error(message('MATLAB:imagesci:validate:wrongNumberOfInputs'));
< 0.001 
     10 
 592
end 
 593 

< 0.001 
     10 
 594
firstString = []; 
< 0.001 
     10 
 595
for k = 1:length(varargin) 
< 0.001 
     20 
 596
    if (ischar(varargin{k})) 
< 0.001 
     10 
 597
        firstString = k; 
< 0.001 
     10 
 598
        break; 
< 0.001 
     10 
 599
    end 
< 0.001 
     10 
 600
end 
 601 

< 0.001 
     10 
 602
if (isempty(firstString)) 
 603 
	error(message('MATLAB:imagesci:imwrite:missingFilename'));
< 0.001 
     10 
 604
end 
 605 

< 0.001 
     10 
 606
switch firstString 
< 0.001 
     10 
 607
case 1 
 608 
	error(message('MATLAB:imagesci:imwrite:firstArgString'));
 609 
    
< 0.001 
     10 
 610
case 2 
 611 
    % imwrite(data, filename, ...)
< 0.001 
     10 
 612
    data = varargin{1}; 
< 0.001 
     10 
 613
    filename = varargin{2}; 
 614 
    
 615 
case 3
 616 
    % imwrite(data, map, filename, ...)
 617 
    data = varargin{1};
 618 
    map = varargin{2};
 619 
    filename = varargin{3};
 620 
    if (size(map,2) ~= 3)
 621 
		error(message('MATLAB:imagesci:imwrite:invalidColormap'));
 622 
    end
 623 
    
 624 
    validateattributes(map,{'numeric'},{'>=',0,'<=',1},'','COLORMAP');
 625 

 626 
otherwise
 627 
    error(message('MATLAB:imagesci:imwrite:badFilenameArgumentPosition'));
< 0.001 
     10 
 628
end 
 629 

< 0.001 
     10 
 630
if (length(varargin) > firstString) 
 631 
    % There are additional arguments after the filename.
< 0.001 
     10 
 632
    if (~ischar(varargin{firstString + 1})) 
 633 
    	error(message('MATLAB:imagesci:imwrite:invalidArguments'));
< 0.001 
     10 
 634
    end 
 635 
    
 636 
    % Is the argument after the filename a format specifier?
  0.008 
     10 
 637
    fmt_s = imformats(varargin{firstString + 1}); 
 638 
    
< 0.001 
     10 
 639
    if (~isempty(fmt_s)) 
 640 
        % imwrite(..., filename, fmt, ...)
< 0.001 
     10 
 641
        format = varargin{firstString + 1}; 
< 0.001 
     10 
 642
        paramPairs = varargin((firstString + 2):end); 
 643 
        
 644 
    else
 645 
        % imwrite(..., filename, prop1, val1, prop2, val2, ...)
 646 
        paramPairs = varargin((firstString + 1):end);
< 0.001 
     10 
 647
    end 
 648 
    
 649 
    % Do some validity checking on param-value pairs
< 0.001 
     10 
 650
    if (rem(length(paramPairs), 2) ~= 0) 
 651 
    	error(message('MATLAB:imagesci:imwrite:invalidSyntaxOrFormat',varargin{firstString + 1}));
< 0.001 
     10 
 652
    end 
 653 

< 0.001 
     10 
 654
end 
 655 

< 0.001 
     10 
 656
for k = 1:2:length(paramPairs) 
< 0.001 
     50 
 657
    validateattributes(paramPairs{k},{'char', 'string'},{'nonempty', 'scalartext'},'','PARAMETER NAME'); 
< 0.001 
     50 
 658
end 
 659 

< 0.001 
     10 
 660
end 

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