657
edits
Line 209: | Line 209: | ||
===Load comma separated values (*.csv) files=== | ===Load comma separated values (*.csv) files=== | ||
{{Code|Load comma separated values files|<syntaxhighlight lang="octave" style="font-size:13px"> | |||
A=textread("file.csv", "%d", "delimiter", ","); | |||
B=textread("file.csv", "%s", "delimiter", ","); | |||
inds = isnan(A); | |||
B(!inds) = num2cell(A(!inds)) | |||
</syntaxhighlight>}} | |||
This gets you a 1 column cell array. You can reshape it to the original size by using the <code>reshape</code> function | This gets you a 1 column cell array. You can reshape it to the original size by using the <code>reshape</code> function | ||
The next version of octave (3.6) implements the <code>CollectOutput</code> switch as seen in example 8 here: http://www.mathworks.com/help/techdoc/ref/textscan.html | The next version of octave (3.6) implements the <code>CollectOutput</code> switch as seen in example 8 here: http://www.mathworks.com/help/techdoc/ref/textscan.html |
edits