Created
October 2, 2014 22:12
-
-
Save grandadmiral-thrawn/b217d4fe3e87b46c00a7 to your computer and use it in GitHub Desktop.
cellparser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [outputmat] = cellparser(cellarray) | |
% CELLPARSER/1(CELLARRAY) converts a cellarray of Nx1 into a cellarray of Nxnumber_of_comma_separated_fields | |
% given a cell array with comma delimiters that you don't know the input-- for example you just read in a .csv with new lines but didn't comma parse | |
% parse the cell array into however many columns it contains | |
for i = 1:length(cellarray) | |
parseline = regexp(cellarray{i},',','split'); | |
bob = length(parseline); | |
outputmat(i,1:bob) = parseline; | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment