MATLAB: How to convert strings to a matrix convertmatrix I'm trying to convert strings to a matrix E.g Hello world would be [hello, world] I have a .m file, and I'm able to read my strings but I don't know how to convert them. Can someone help me. Best Answer This code takes in account more then one blanck spaces='Hello world's1=regexp(s,' ','split'); out=s1(~cellfun(@isempty ,s1)) Related SolutionsMATLAB: Find the string from the cell array a = {'s_ddfa_af' ; 'adfa' ; 'f_dsfa_dasf_sdf'; 'asdf_dd'};out=regexpi(a,'^s\w*','match') MATLAB: Making upper case character with respect to the indexes Try this:indxC = [1,7];s ='hello world';s(indxC) = upper(s(indxC))or more generally:s ='hello world';upperS = upper(s); % Create an ALL CAPITALS VERSION of s.spaceLocations = find(s(1:end-1) == ' '); % Find spaces - we'll capitalize the location after a space.spaceLocations = [0, spaceLocations] % Always capitalize the first letter, so prepend 0.s(spaceLocations + 1) = upperS(spaceLocations + 1) % Replace these locations with upper case letters. Related Question[GIS] Adding a map from a website into QGISHow to search for a string in a text file that has carriage returns within the stringUsing numbers in wordcloudAny possibilities of using sortrows for strings
Best Answer