%CONVERT_STRING_ARRAY % % USAGE: % newColumn = convert_string_array(column) % % This function takes a cell array containing single string elements, and % returns a numeric vector. Behaviour is undefined if any element in the % input array cannot be parsed by num2str. % % INPUT ARGUMENTS: % column: An array of strings containing numeric data. % % OUTPUT: % newColumn: A numeric vector containing the numbers from column. % % Author: Robert Wagner % Date: 5th March 2009 % Last Modified: 12th March 2009 function newColumn = convert_string_array(column) for n = 1:length(column) if isempty(column{n}) newColumn(n) = NaN; else newColumn(n) = str2num(column{n}); end end