time | Calls | line |
---|
| | 262 | function [varnames,nestedVarnames,underlines] = getVarNamesDispLines()
|
| | 263 |
|
< 0.001 | 8 | 264 | varStrs = strings(1,t.varDim.length);
|
< 0.001 | 8 | 265 | ulStrs = strings(1,t.varDim.length);
|
< 0.001 | 8 | 266 | if haveNestedTable, nestedVarnameDispWidths = ceil(vectorizedWrappedLength(nestedVarnameStrs)); end
|
| | 267 |
|
< 0.001 | 8 | 268 | for ii = 1:t.varDim.length
|
< 0.001 | 56 | 269 | varname = varNames(ii);
|
| | 270 | % Use the wider of varDispWidth and varNamesDispWidth to
|
| | 271 | % determine the header width and pad to the varDispWidth if
|
| | 272 | % necessary. However, when padding, this number has to be
|
| | 273 | % adjusted to account for the fact that the number of
|
| | 274 | % characters in the char vector for the varname do not
|
| | 275 | % correspond to the display width, due to:
|
| | 276 | % * Strong tags
|
| | 277 | % * Hyperlinks (and thus no strong tags)
|
| | 278 | % * Wide characters
|
| | 279 | % * Narrow characters or wide-displaying characters that don't
|
| | 280 | % report to be wide (nothing to be done about those).
|
| | 281 |
|
| | 282 | % Pad out variable names if necessary to match the data display
|
| | 283 | % width. Varnames have already been made bold.
|
< 0.001 | 56 | 284 | varnameNumCharsToDisp = strlength(varname) + (varDispWidths(ii) - varNameDispWidths(ii));
|
< 0.001 | 56 | 285 | varStrs(ii) = pad(varname, ... % wrap tightly with strong tags
|
| 56 | 286 | varnameNumCharsToDisp,'both',' ');
|
< 0.001 | 56 | 287 | if haveNestedTable
|
| | 288 | % Pad the nested var names out to the full data display width,
|
| | 289 | % accounting for bold markup tags around each nested name.
|
| | 290 | nestedVarnameStrs(ii) = pad(nestedVarnameStrs(ii), ...
|
| | 291 | strlength(nestedVarnameStrs(ii)) + (varDispWidths(ii) - nestedVarnameDispWidths(ii)),'both',' ');
|
< 0.001 | 56 | 292 | end
|
| | 293 | % Create underlines under each variable name to the full data
|
| | 294 | % display width.
|
0.001 | 56 | 295 | ulStrs(ii) = nUnder(ulDispWidths(ii));
|
< 0.001 | 56 | 296 | end
|
| | 297 |
|
< 0.001 | 8 | 298 | if t.dispRowLabelsHeader
|
| | 299 | % Need to print the name of the rowDim; add it to the beginning
|
| | 300 | % of the array
|
| | 301 | ulStrs = [nUnder(rownameWidth), ulStrs];
|
| | 302 | varStrs = [pad(rowDimName, ... % wrap tightly with strong tags
|
| | 303 | strlength(rowDimName) + (rownameWidth - rowDimNameWidth),'both',' '), varStrs];
|
| | 304 | nestedVarnameStrs = [nSpaces(rownameWidth), nestedVarnameStrs];
|
< 0.001 | 8 | 305 | end
|
| | 306 |
|
| | 307 | % Join all the variable names and underlines with spaces.
|
< 0.001 | 8 | 308 | spacesBetween = string(nSpaces(between));
|
< 0.001 | 8 | 309 | if ~t.dispRowLabelsHeader && t.rowDim.hasLabels
|
| | 310 | % table doesn't print a header (dimname) for rownames, but we
|
| | 311 | % still have to account for the width with additional spaces.
|
< 0.001 | 8 | 312 | leadingSpaces = nSpaces(indent + rownameWidth + between);
|
| | 313 | else
|
| | 314 | % timetables always wind up here, and tables without rownames
|
| | 315 | leadingSpaces = nSpaces(indent);
|
< 0.001 | 8 | 316 | end
|
| | 317 |
|
< 0.001 | 8 | 318 | varnames = leadingSpaces + join(varStrs,spacesBetween);
|
< 0.001 | 8 | 319 | nestedVarnames = leadingSpaces + join(nestedVarnameStrs,spacesBetween);
|
< 0.001 | 8 | 320 | underlines = leadingSpaces + join(strongBegin + ulStrs + strongEnd, spacesBetween) + looseline;
|
< 0.001 | 8 | 321 | end
|
Other subfunctions in this file are not included in this listing.