This is a static copy of a profile report

Home

VarOptsInputs>VarOptsInputs.VarOptsInputs (Calls: 45, Time: 0.002 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\VarOptsInputs.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...leImportOptions.VariableImportOptionsclass method45
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
1
classdef VarOptsInputs < ma...
450.000 s0.5%
All other lines  0.002 s99.5%
Totals  0.002 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...arOpts>CommonVarOpts.CommonVarOptsclass method450.000 s19.3%
...eatAsMissingInput.TreatAsMissingInputclass method450.000 s18.6%
Self time (built-ins, overhead, etc.)  0.001 s62.1%
Totals  0.002 s100% 
Code Analyzer results
Line numberMessage
57The set method for the property 'Name' should not access another property ('Name_').
66The set method for the property 'Type' should not access another property ('Type_').
74The set method for the property 'FillValue' should not access another property ('FillValue_').
Coverage results
Show coverage for parent directory
Total lines in function121
Non-code lines (comments, blank lines)81
Code lines (lines that can run)40
Code lines that did run1
Code lines that did not run39
Coverage (did run/can run)2.50 %
Function listing
time 
Calls 
 line
< 0.001 
     45 
   1
classdef VarOptsInputs < matlab.io.internal.FunctionInterface ... 
   2 
        & matlab.io.internal.shared.TreatAsMissingInput ...
   3 
        & matlab.io.internal.shared.CommonVarOpts
   4 
    %
   5 

   6 
    %   Copyright 2018-2019 The MathWorks, Inc.
   7 

   8 
    properties (Access = {?matlab.io.internal.shared.NumericVarOptsInputs,...
   9 
                          ?matlab.io.internal.functions.ReadMatrixWithImportOptions,...
  10 
                          ?matlab.io.VariableImportOptions,...
  11 
                          ?matlab.io.internal.functions.DetectImportOptions,...
  12 
                          ?matlab.io.internal.FastVarOpts,...
  13 
                          ?matlab.io.internal.builders.Builder})
  14 
        Name_ = '';
  15 
        Type_ = '';
  16 
        FillValue_;
  17 
    end
  18 

  19 
    properties (Parameter)
  20 
        %NAME
  21 
        %   Name of the variable to be imported. Must be a valid identifier.
  22 
        %
  23 
        % See also matlab.io.VariableImportOptions
  24 
        Name
  25 

  26 
        %TYPE
  27 
        %   The input type of the variable when imported.
  28 
        %
  29 
        % See also matlab.io.VariableImportOptions
  30 
        Type
  31 

  32 
        %FILLVALUE
  33 
        %   Used as a replacement value when ErrorRule = 'fill' or
  34 
        %   MissingRule = 'fill'. The valid types depend on the value of TYPE.
  35 
        %
  36 
        % See also matlab.io.VariableImportOptions
  37 
        %   matlab.io.spreadsheet.SpreadsheetImportOptions/MissingRule
  38 
        %   matlab.io.spreadsheet.SpreadsheetImportOptions/ImportErrorRule
  39 
        %   matlab.io.VariableImportOptions/Type
  40 
        FillValue
  41 
    end
  42 
    % get/set functions
  43 
    methods
  44 
        function obj = set.Name(obj,rhs)
  45 
            rhs = convertCharsToStrings(rhs);
  46 
            if ~(isstring(rhs) && isscalar(rhs))
  47 
                error(message('MATLAB:textio:textio:InvalidStringProperty','Name'));
  48 
            end
  49 

  50 
            % Make sure that the Variable Options name is non-empty and
  51 
            % not greater than namelengthmax.
  52 
            stringLength = strlength(rhs);
  53 
            if stringLength == 0 || stringLength > namelengthmax
  54 
                error(message('MATLAB:table:VariableNameNotValidIdentifier', rhs));
  55 
            end
  56 

  57 
            obj.Name_ = char(rhs);
  58 
        end
  59 

  60 
        function val = get.Name(opts)
  61 
            val = opts.Name_;
  62 
        end
  63 

  64 
        function obj = set.Type(obj,val)
  65 
            val = convertStringsToChars(val);
  66 
            obj.Type_ = setType(obj,val);
  67 
        end
  68 

  69 
        function val = get.Type(obj)
  70 
            val = getType(obj,obj.Type_);
  71 
        end
  72 

  73 
        function obj = set.FillValue(obj,val)
  74 
            obj.FillValue_ = setFillValue(obj,val);
  75 
        end
  76 

  77 
        function val = get.FillValue(obj)
  78 
        % Converts to the correct type
  79 
            val = getFillValue(obj,obj.FillValue_);
  80 
        end
  81 
    end
  82 

  83 
    methods (Hidden, Sealed)
  84 
        function opts = setNames(opts,names)
  85 
        % avoid validating names
  86 
            if ~isempty(names)
  87 
                ids = ~strcmp(names,{opts.Name_});
  88 
                for id = find(ids)
  89 
                    opts(id).Name_ = names{id};
  90 
                end
  91 
            end
  92 
        end
  93 

  94 
        function names = getNames(opts)
  95 
        % avoid validating names
  96 
            names = {opts.Name_};
  97 
        end
  98 
    end
  99 

 100 
    methods (Abstract,Access = protected)
 101 
        type = setType(obj,val);
 102 
        type = getType(obj,val);
 103 
        val = setFillValue(obj,val);
 104 
        val = getFillValue(obj,val);
 105 
    end
 106 

 107 
    methods (Static)
 108 
        function validateFixedType(name,type,rhs)
 109 
            import matlab.io.internal.supportedTypeNames
 110 
            rhs = convertCharsToStrings(rhs);
 111 
            if ~isstring(rhs) || ~any(strcmp(supportedTypeNames,rhs))
 112 
                error(message('MATLAB:textio:io:NotDataType'));
 113 
            end
 114 
            newMsg = [getString(message('MATLAB:textio:io:StaticOptionsType',type)), ...
 115 
                      '\n\n',getString(message('MATLAB:textio:io:Setdatatype')), '\n', ...
 116 
                      getString(message('MATLAB:textio:io:SetvartypeSyntax',name,rhs))];
 117 
            throw(MException('MATLAB:textio:io:StaticOptionsType',newMsg));
 118 
        end
 119 
    end
 120 
end
 121