This is a static copy of a profile report

Home

TextVarOptsInputs>TextVarOptsInputs.TextVarOptsInputs (Calls: 30, Time: 0.000 s)
Generated 04-Jun-2021 04:11:10 using performance time.
class method in file C:\Program Files\MATLAB\R2020b\toolbox\shared\io\general\+matlab\+io\+internal\+shared\TextVarOptsInputs.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...portOptions.TextVariableImportOptionsclass method30
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
1
classdef TextVarOptsInputs <...
300.000 s3.0%
All other lines  0.000 s97.0%
Totals  0.000 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
48This import statement runs before any other code in function 'setType'. Consider placing it at the top of the function body.
Coverage results
Show coverage for parent directory
Total lines in function83
Non-code lines (comments, blank lines)42
Code lines (lines that can run)41
Code lines that did run1
Code lines that did not run40
Coverage (did run/can run)2.44 %
Function listing
time 
Calls 
 line
< 0.001 
     30 
   1
classdef TextVarOptsInputs < matlab.io.internal.FunctionInterface 
   2 
    %
   3 

   4 
%   Copyright 2018 The MathWorks, Inc.
   5 
    
   6 
    properties (Parameter)
   7 
        %WHITESPACERULE
   8 
        %   Rules for dealing with leading and trailing whitespace when importing
   9 
        %   text data.
  10 
        %   'trim' - (default) Any leading or trailing whitespace is removed from
  11 
        %            the text. Interior whitespace is unaffected.
  12 
        %
  13 
        %   'trimleading' - Only the leading whitespace will be removed.
  14 
        %
  15 
        %   'trimtrailing' - Only the trailing whitespace will be removed.
  16 
        %
  17 
        %   'preserve' - No whitespace will be removed.
  18 
        %
  19 
        %   See also matlab.io.TextVariableImportOptions
  20 
        WhitespaceRule = 'trim';
  21 
    end
  22 
    
  23 
    methods
  24 
        function obj = set.WhitespaceRule(obj,rhs)
  25 
        obj.WhitespaceRule = validatestring(rhs,...
  26 
            {'trim','trimleading','trimtrailing','preserve'});
  27 
        end
  28 
    end
  29 
    
  30 
    methods (Access = protected)
  31 
        function val = setFillValue(~,val)
  32 
        % Only accept cellstr with 1 char element.
  33 
        val = convertCharsToStrings(val);
  34 
        
  35 
        if ~(isstring(val) && isscalar(val))
  36 
            if isa(val,'missing') && isscalar(val)
  37 
                val = string(missing);
  38 
                return
  39 
            end
  40 
            error(message('MATLAB:textio:io:FillValueText'));
  41 
        end
  42 
        end
  43 
        
  44 
        function val = setType(obj,val)
  45 
        try
  46 
            val = validatestring(val,{'char','string'});
  47 
        catch ME
  48 
            import matlab.io.internal.supportedTypeNames
  49 
            if strcmp(ME.identifier,'MATLAB:unrecognizedStringChoice') && any(strcmp(supportedTypeNames,val))
  50 
                % additional information to help with debugging
  51 
                newMsg = ['\n\n',getString(message('MATLAB:textio:io:Setdatatype')), '\n', ...
  52 
                    getString(message('MATLAB:textio:io:SetvartypeSyntax',obj.Name,val))];
  53 
                throw(MException('MATLAB:unrecognizedStringChoice',[ME.message, newMsg]));
  54 
            end
  55 
            throw(ME);
  56 
        end
  57 
        end
  58 
        
  59 
        function val = getType(~,val)
  60 
        if isempty(val), val = 'char';end
  61 
        end
  62 
        
  63 
        function val = getFillValue(obj,val)
  64 
        if isnumeric(val) % default []
  65 
            switch obj.Type
  66 
                case 'char'
  67 
                    val = '';
  68 
                case 'string'
  69 
                    val = string(missing);
  70 
            end
  71 
        else
  72 
            switch obj.Type
  73 
                case 'char'
  74 
                    val = convertStringsToChars(val);
  75 
                case 'string'
  76 
                    val = convertCharsToStrings(val);
  77 
            end
  78 
        end
  79 
        end
  80 
    end
  81 
end
  82 

  83