This is a static copy of a profile reportHome
importdata>analyze (4 calls, 0.907 sec)
Generated 05-Aug-2011 13:01:24 using cpu time.
subfunction in file /usr/local/MATLAB/R2011a/toolbox/matlab/iofun/importdata.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
513 | Data = textscan(fileString,'%[... | 4 | 0.885 s | 97.6% |  |
522 | [isvalid, numHeaderCols, numHe... | 4 | 0.022 s | 2.4% |  |
583 | end | 4 | 0 s | 0% |  |
579 | if numHeaderCols > 0 | 4 | 0 s | 0% |  |
578 | numColumns = length(delimiterI... | 4 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.907 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
importdata>isvaliddata | subfunction | 4 | 0.022 s | 2.4% |  |
Self time (built-ins, overhead, etc.) | | | 0.885 s | 97.6% |  |
Totals | | | 0.907 s | 100% | |
Code Analyzer results
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 84 |
Non-code lines (comments, blank lines) | 26 |
Code lines (lines that can run) | 58 |
Code lines that did run | 26 |
Code lines that did not run | 32 |
Coverage (did run/can run) | 44.83 % |
Function listing
time calls line
500 function [numColumns, numHeaderRows, numHeaderCols, numHeaderChars] = ...
501 analyze(fileString, delim, header, bufsize)
502 %ANALYZE count columns, header rows and header columns
503
4 504 numColumns = 0;
4 505 numHeaderRows = 0;
4 506 numHeaderCols = 0;
4 507 numHeaderChars = 0;
508
4 509 if ~isnan(header)
4 510 numHeaderRows = header;
4 511 end
512
0.89 4 513 Data = textscan(fileString,'%[^\n\r]',1,'headerlines',numHeaderRows,...
514 'delimiter',delim.requested,'bufsize', bufsize);
4 515 thisLine = Data{1};
516
4 517 if isempty(thisLine)
518 return;
519 end
4 520 thisLine = thisLine{:};
521
0.02 4 522 [isvalid, numHeaderCols, numHeaderChars] = isvaliddata(thisLine, delim);
523
4 524 if ~isvalid && isnan(header)
525 numHeaderRows = numHeaderRows + 1;
526 Data = textscan(fileString,'%[^\n\r]',1,'headerlines',numHeaderRows,...
527 'delimiter',delim.requested, 'bufsize', bufsize);
528
529 thisLine = Data{1};
530 if isempty(thisLine)
531 return;
532 end
533 thisLine = thisLine{1};
534
535 [isvalid, numHeaderCols, numHeaderChars] = isvaliddata(thisLine, delim);
536 while ~isvalid
537 % stop now if the user specified a number of header lines
538 if ~isnan(header) && numHeaderRows == header
539 break;
540 end
541 numHeaderRows = numHeaderRows + 1;
542 if numHeaderRows >= 1000
543 %Assume no data.
544 Data = textscan(fileString,'%[^\n\r]','headerlines',numHeaderRows,...
545 'delimiter',delim.requested, 'bufsize', bufsize);
546 thisLine = Data{1};
547 numHeaderRows = length(thisLine) + numHeaderRows;
548 break;
549 end
550 Data = textscan(fileString,'%[^\n\r]',1,'headerlines',numHeaderRows,...
551 'delimiter',delim.requested, 'bufsize', bufsize);
552
553 thisLine = Data{1};
554 if isempty(thisLine)
555 break;
556 end
557 thisLine = thisLine{1};
558 [isvalid, numHeaderCols, numHeaderChars] = isvaliddata(thisLine, delim);
559 end
560 end
561
562 % This check could happen earlier
4 563 if ~isnan(header) && numHeaderRows >= header
4 564 numHeaderRows = header;
4 565 end
566
4 567 if isvalid
568 % determine num columns
569 %remove trailing spaces. Spaces are different from other delimiters.
4 570 thisLine = regexprep(thisLine, ' +$', '');
4 571 delimiterIndexes = strfind(thisLine, delim.printed);
4 572 if all(delim.printed ==' ') && length(delimiterIndexes) > 1
4 573 delimiterIndexes = delimiterIndexes([true diff(delimiterIndexes) ~= 1]);
4 574 delimiterIndexes = delimiterIndexes(delimiterIndexes > 1);
4 575 end
576
577 % format string should have 1 more specifier than there are delimiters
4 578 numColumns = length(delimiterIndexes) + 1;
4 579 if numHeaderCols > 0
580 % add one to numColumns because the two set of columns share a delimiter
581 numColumns = numColumns - numHeaderCols;
582 end
4 583 end
Other subfunctions in this file are not included in this listing.