time | Calls | line |
---|
| | 59 | function opts = execute(func,supplied)
|
| | 60 | % Detect the appropriate object by file type
|
< 0.001 | 2 | 61 | switch func.FileType
|
< 0.001 | 2 | 62 | case {'text','delimitedtext','fixedwidth'}
|
| | 63 | opts = func.execute@matlab.io.internal.functions.DetectImportOptionsText(supplied);
|
< 0.001 | 2 | 64 | case 'spreadsheet'
|
0.221 | 2 | 65 | opts = func.execute@matlab.io.internal.functions.DetectImportOptionsSpreadsheet(supplied);
|
| | 66 | otherwise
|
| | 67 | assert(false);
|
< 0.001 | 2 | 68 | end
|
| | 69 |
|
< 0.001 | 2 | 70 | if supplied.EmptyValue
|
| | 71 | sfillValue = struct("FillValue", func.EmptyValue);
|
| | 72 | idx = find(ismember(opts.fast_var_opts.Types,["double","auto"]));
|
| | 73 | opts.fast_var_opts = opts.fast_var_opts.assignVarOptsProps(sfillValue, "FillValue", idx); %#ok<FNDSB>
|
| 2 | 74 | end
|
| | 75 |
|
< 0.001 | 2 | 76 | if supplied.MultipleDelimsAsOne
|
| | 77 | supplied.ConsecutiveDelimitersRule = true;
|
| | 78 | supplied.LeadingDelimitersRule = true;
|
< 0.001 | 2 | 79 | end
|
| | 80 |
|
< 0.001 | 2 | 81 | textType = func.TextType;
|
| | 82 |
|
< 0.001 | 2 | 83 | if supplied.DatetimeType
|
| | 84 | dtType = func.DatetimeType;
|
| | 85 | if dtType =="text"
|
| | 86 | dtType = textType;
|
| | 87 | elseif dtType == "exceldatenum"
|
| | 88 | dtType = "double";
|
| | 89 | end
|
| | 90 | idx = find(opts.VariableTypes == "datetime");
|
| | 91 | opts.fast_var_opts = opts.fast_var_opts.setTypes(idx,convertStringsToChars(dtType)); %#ok<FNDSB>
|
< 0.001 | 2 | 92 | end
|
| | 93 |
|
< 0.001 | 2 | 94 | if supplied.DurationType
|
| | 95 | if func.DurationType=="text"
|
| | 96 | dtType = textType;
|
| | 97 | else
|
| | 98 | dtType = func.DurationType;
|
| | 99 | end
|
| | 100 | idx = find(opts.VariableTypes == "duration");
|
| | 101 | opts.fast_var_opts = opts.fast_var_opts.setTypes(idx,convertStringsToChars(dtType)); %#ok<FNDSB>
|
| | 102 |
|
< 0.001 | 2 | 103 | end
|
| | 104 |
|
| | 105 | % Default TextType for text and spreadsheet is char
|
< 0.001 | 2 | 106 | if supplied.TextType && (textType == "string")
|
| | 107 | idx = find(opts.VariableTypes == "char");
|
| | 108 | if ~isempty(idx)
|
| | 109 | opts.fast_var_opts = opts.fast_var_opts.setTypes(idx,"string");
|
| | 110 | end
|
< 0.001 | 2 | 111 | end
|
| | 112 |
|
| | 113 | % Default TextType for XML is string
|
< 0.001 | 2 | 114 | if supplied.TextType && (textType == "char")
|
| | 115 | idx = find(opts.VariableTypes == "string");
|
| | 116 | if ~isempty(idx)
|
| | 117 | opts.fast_var_opts = opts.fast_var_opts.setTypes(idx,"char");
|
| | 118 | end
|
| 2 | 119 | end
|
| | 120 |
|
< 0.001 | 2 | 121 | if supplied.ImportErrorRule, opts.ImportErrorRule = func.ImportErrorRule; end
|
< 0.001 | 2 | 122 | if supplied.MissingRule, opts.MissingRule = func.MissingRule; end
|
< 0.001 | 2 | 123 | if supplied.ExtraColumnsRule, opts.ExtraColumnsRule = func.ExtraColumnsRule; end
|
| | 124 |
|
| | 125 | % Set PreserveVariableNames on the generated text/spreadsheet
|
| | 126 | % opts object.
|
< 0.001 | 2 | 127 | opts.PreserveVariableNames = func.PreserveVariableNames;
|
| | 128 |
|
0.001 | 2 | 129 | opts = opts.setUnboundedSelection(true);
|
0.001 | 2 | 130 | opts = opts.useGeneratedNames(0);
|
< 0.001 | 2 | 131 | end
|
Other subfunctions in this file are not included in this listing.