MATLAB: How to convert numbers in cell array into double cell arrays I have a cell array like a = '22 16 55.40', which is dMS values, how to separate these three numbers into three cells into numeric array as follows:- a = '22 16 55.40' to b = [22 16 55.40]. Any help is greatly appreciated. Best Answer The textscan function works:a = {'22 16 55.40'};b = textscan(char(a), '%f %f %f')produces:b = [22.0000e+000] [16.0000e+000] [55.4000e+000]with b being a (1x3) cell array. Related SolutionsMATLAB: Convert text cell to double z = {'$88.10' '$83.01' '$80.22' '$80.22'};out = cellfun(@(x)str2double(x(2:end)),z); MATLAB: How to read begin to read data after a string filename = 'ConcreteStresses.txt';S = fileread(filename);idx = regexp(S, '^\s*\d', 'once', 'lineanchors');fmt = repmat('%f', 1, 7);data = cell2mat( textscan(S(idx:end), fmt) );fcz = data(:,4); Related QuestionProblem using fprintf, extra character printed each lineSortrows(data, [2,1]) is doing the 2nd round of sorting incorrectly in MATLAB R2017a
Best Answer