This is a static copy of a profile reportHome
imwrite>parse_inputs (40 calls, 0.066 sec)
Generated 05-Aug-2011 13:01:19 using cpu time.
subfunction in file /usr/local/MATLAB/R2011a/toolbox/matlab/imagesci/imwrite.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
imwrite | function | 40 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
558 | fmt_s = imformats(varargin{fir... | 40 | 0.033 s | 50.0% |  |
516 | if (isempty(firstString)) | 40 | 0.011 s | 16.7% |  |
508 | firstString = []; | 40 | 0.011 s | 16.7% |  |
584 | end | 200 | 0 s | 0% |  |
580 | if (~ischar(paramPairs{k})) | 200 | 0 s | 0% |  |
All other lines | | | 0.011 s | 16.7% |  |
Totals | | | 0.066 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
imformats | function | 40 | 0.033 s | 50.0% |  |
Self time (built-ins, overhead, etc.) | | | 0.033 s | 50.0% |  |
Totals | | | 0.066 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 92 |
Non-code lines (comments, blank lines) | 26 |
Code lines (lines that can run) | 66 |
Code lines that did run | 30 |
Code lines that did not run | 36 |
Coverage (did run/can run) | 45.45 % |
Function listing
time calls line
493 function [data, map, filename, format, paramPairs, msg] = ...
494 parse_inputs(varargin)
495
40 496 data = [];
40 497 map = [];
40 498 filename = '';
40 499 format = '';
40 500 paramPairs = {};
40 501 msg = '';
502
40 503 if (nargin < 2)
504 msg = 'Too few input arguments';
505 return;
506 end
507
0.01 40 508 firstString = [];
40 509 for k = 1:length(varargin)
80 510 if (ischar(varargin{k}))
40 511 firstString = k;
40 512 break;
513 end
40 514 end
515
0.01 40 516 if (isempty(firstString))
517 msg = 'Invalid input arguments: missing filename';
518 return;
519 end
520
40 521 switch firstString
40 522 case 1
523 msg = 'Invalid input arguments: first argument should not be a string';
524 return;
525
40 526 case 2
527 % imwrite(data, filename, ...)
40 528 data = varargin{1};
40 529 filename = varargin{2};
530
531 case 3
532 % imwrite(data, map, filename, ...)
533 data = varargin{1};
534 map = varargin{2};
535 filename = varargin{3};
536 if (size(map,2) ~= 3)
537 msg = 'Invalid colormap';
538 return;
539 end
540
541 if ((min(map(:)) < 0) || (max(map(:)) > 1))
542 warning('MATLAB:imwrite:colormapRange', 'Colormap data should be in the range 0 to 1.')
543 end
544
545 otherwise
546 msg = 'Invalid input arguments: missing filename';
547 return;
548 end
549
40 550 if (length(varargin) > firstString)
551 % There are additional arguments after the filename.
40 552 if (~ischar(varargin{firstString + 1}))
553 msg = 'Invalid input arguments.';
554 return;
555 end
556
557 % Is the argument after the filename a format specifier?
0.03 40 558 fmt_s = imformats(varargin{firstString + 1});
559
40 560 if (~isempty(fmt_s))
561 % imwrite(..., filename, fmt, ...)
40 562 format = varargin{firstString + 1};
40 563 paramPairs = varargin((firstString + 2):end);
564
565 else
566 % imwrite(..., filename, prop1, val1, prop2, val2, ...)
567 paramPairs = varargin((firstString + 1):end);
568 end
569
570 % Do some validity checking on param-value pairs
40 571 if (rem(length(paramPairs), 2) ~= 0)
572 msg = sprintf('Invalid input syntax or unrecognized format "%s"', ...
573 varargin{firstString + 1});
574 return;
575 end
576
40 577 end
578
40 579 for k = 1:2:length(paramPairs)
200 580 if (~ischar(paramPairs{k}))
581 msg = 'Parameter names must be strings';
582 return;
583 end
200 584 end
Other subfunctions in this file are not included in this listing.