Skip to content

__nexus_delimited_util__

io · scripts/io/__nexus_delimited_util__.m

NEXUS_DELIMITED_UTIL  Shared text-file reading for readtable, readmatrix and readcell.

 [R, nf, delim] = __nexus_delimited_util__ ('read', filename, delim, nhl, mode)
   R is a cell of trimmed field text, one row per non-blank line, '' where a
   line has no such field.  nf is the number of fields on each line.  mode
   is 'wide' (readtable, readmatrix) or 'even' (readcell), which choose the
   delimiter differently, as MATLAB's own detection does.
 first = __nexus_delimited_util__ ('firstrow', nf)
   The line where the data of a 'wide' read starts, and the column count.
 [kind, value] = __nexus_delimited_util__ ('kinds', R)
   kind is a char matrix: n number, c complex, i bare imaginary unit,
   d date, u duration, t text, space for empty.  value holds the numbers.
 v = __nexus_delimited_util__ ('datetime', tokens, display)
   Convert date tokens of one column (or one token).  [] when they do not
   share a format.  display true keeps the format of the text.
 v = __nexus_delimited_util__ ('duration', tokens)

 Writers (writetable, writematrix, writecell):
 o = __nexus_delimited_util__ ('writeargs', caller, args)
   Parse the name-value pairs of a text target.
 name = __nexus_delimited_util__ ('filename', caller, filename)
   Check the file name argument; the result is a char row.
 name = __nexus_delimited_util__ ('target', caller, name, o)
   Add .txt when there is no extension and check the extension.
 fid = __nexus_delimited_util__ ('open', name, o)
 [F, K] = __nexus_delimited_util__ ('arrayfields', x)
 [F, K] = __nexus_delimited_util__ ('stringfields', C, miss)
   A string array as cellstr (C) and ismissing (miss): a string passed to
   this function by name would arrive as a cell.
 [F, K] = __nexus_delimited_util__ ('cellfields', C, strict, delim)
   F is a cell of field text, one row per row of the data.  K is a char
   matrix: n number, t text, - nothing to quote.
 F = __nexus_delimited_util__ ('quote', F, K, o)
   Apply the quoting rule to one group: a table variable or a whole array.
 __nexus_delimited_util__ ('writerows', fid, F, o)
 __nexus_delimited_util__ ('badtype', x)
   The error for an input another writer handles.