Commit 56d73260 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

DOC: Expand on matlab commands. I vomited while writing this.

parent 2a50df24
......@@ -177,16 +177,18 @@ The ``readtable`` function returns a |table|_ object, which stores each column
as a separate vector (or cell-array for non-numeric columns). If you are only
interested in numeric columns, you can retrieve them as an array like this::
data = data(:, vartype('numeric')).Variables;
rawdata = data(:, vartype('numeric')).Variables;
The ``readtable`` function will potentially rename the column names to ensure
that they are are valid MATLAB identifiers. You can retrieve the original
names from the ``table`` object like so::
colnames = regexp(data.Properties.VariableDescriptions, ...
'''(.+)''', 'tokens', 'once');
colnames = vertcat(colnames{:});
colnames = data.Properties.VariableDescriptions;
colnames = regexp(colnames, '''(.+)''', 'tokens', 'once');
empty = cellfun(@isempty, colnames);
colnames(empty) = data.Properties.VariableNames(empty);
colnames = vertcat(colnames{:});
If you have used the ``--description_file`` option, you can load in the
......@@ -195,7 +197,11 @@ descriptions for each column as follows::
descs = readtable('descriptions.tsv', ...
'FileType', 'text', ...
descs = descs.Var2;
descs = [descs; {'eid', 'ID'}];
idxs = cellfun(@(x) find(strcmp(descs.Var1, x)), colnames, ...
'UniformOutput', false);
idxs = cell2mat(idxs);
descs = descs.Var2(idxs);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment