time | Calls | line |
---|
| | 200 | function rhs = validateDataRange(obj,rhs)
|
| | 201 | % Determine how DataRange was specified and then delegate to
|
| | 202 | % the appropriate validators
|
< 0.001 | 2 | 203 | rhs = convertStringsToChars(rhs);
|
< 0.001 | 2 | 204 | [nrows, ncols] = size(rhs);
|
| | 205 |
|
< 0.001 | 2 | 206 | if (~ischar(rhs) && ncols > 1) || nrows > 1
|
| | 207 | temprhs = rhs;
|
| | 208 | if iscellstr(rhs)
|
| | 209 | for i = 1:nrows
|
| | 210 | type = ...
|
| | 211 | matlab.io.spreadsheet.internal.validateRange(rhs{i});
|
| | 212 | if ~strcmp(type, 'row-only')
|
| | 213 | error(message('MATLAB:spreadsheet:importoptions:RowOnlyRanges'));
|
| | 214 | end
|
| | 215 | end
|
| | 216 | % convert the intervals to numeric for validation
|
| | 217 | temprhs = str2double(split(string(rhs),':'));
|
| | 218 | elseif ~isnumeric(rhs)
|
| | 219 | error(message('MATLAB:spreadsheet:importoptions:InvalidDataRange'));
|
| | 220 | else
|
| | 221 | % Convert to double
|
| | 222 | rhs = double(rhs);
|
| | 223 | end
|
| | 224 | try
|
| | 225 | % validate the 'DataLines' syntax
|
| | 226 | matlab.io.internal.validators.validateLineIntervals(temprhs,'DataRange');
|
| | 227 | catch ME
|
| | 228 | if strcmp(ME.identifier,'MATLAB:textio:io:InvalidDataLines')
|
| | 229 | error(message('MATLAB:spreadsheet:importoptions:InvalidDataRange'));
|
| | 230 | else
|
| | 231 | throw(ME);
|
| | 232 | end
|
| | 233 | end
|
< 0.001 | 2 | 234 | elseif isempty(rhs)
|
| | 235 | error(message('MATLAB:spreadsheet:importoptions:InvalidDataRange'));
|
| 2 | 236 | else
|
0.007 | 2 | 237 | rhs = validateRange(rhs,'DataRange',@NumVars,obj.getNumVars());
|
< 0.001 | 2 | 238 | end
|
< 0.001 | 2 | 239 | end
|
Other subfunctions in this file are not included in this listing.