MATLAB: Transform char variable to matrix MATLABvariable Hi, I have a cell variable that looks like this: I'D like to know if there is a way to transform it into a matrix of this kind: NewVar=[2 5; 2 3; 2 5]; Thanks Best Answer tmp = {'002,005';'002,003';'002,005'};NewVar = cell2mat(cellfun(@(S) sscanf(S, '%f,%f').', tmp, 'uniform', 0)); Related SolutionsMATLAB: Changing the format of a cell matrix cell2mat(cellfun(@(S) sscanf(S, '%f %f:%f:%f %f %f').',data,'uniform', 0)) MATLAB: Mag_curve_1 how to plot When I define your data as:M = [-1.8000000e+003 -1.3000000e-003 -1.7640000e+003 -1.2956598e-003 -1.7280000e+003 -1.2916738e-003 -1.6920000e+003 -1.2879611e-003 . . . 0.0000000e+000 0.0000000e+000 3.6000000e+001 9.2857143e-005];and plot it:figure(1)plot(M(:,1), M(:,2))gridit plots a single curve. Related QuestionLoad—-problem in using this commadSubstracting a number from certain section of the arrayHow to change variable name from known stringDistance difference from centerHow to read the text files with the format “13.07.2013,00:00:00,0044,918,47,200,0930,019,23,9,0178,75,63, +RA, R+,03041,02059,0,06,SPECTRUM,,,,,,,001,,,,,,,,,,,,,,,,,,,,,,,,,,,,003,001,001,,,001,,001,,,,,,,,,,,,,,,,,,,,,,,,,,002,,0
Best Answer