Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
ukbparse
Commits
56d73260
Commit
56d73260
authored
May 08, 2019
by
Paul McCarthy
🚵
Browse files
DOC: Expand on matlab commands. I vomited while writing this.
parent
2a50df24
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.rst
View file @
56d73260
...
...
@@ -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;
raw
data = 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', ...
'ReadVariableNames',false);
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);
Tests
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment