MATLAB: How can we find the non common strings from multiple columns strings any suggestions? Thanks in advance. Best Answer First lets find the strings that are common to all cell arrays:listA={'India','Iran','Ireland','Israel','Jordan','Kuwait','Lebanon','Lesotho','Libya','Luxembourg','Malawi','Maldives','Morocco','Nepal','Netherlands','Norway','Oman','Paraguay','Peru','Philippines',};listB={'Denmark','El Salvador','Gabon','Gambia','Lebanon','Lesotho','Libya','Luxembourg','Malawi','Maldives','Morocco','Nepal','Netherlands','Norway','Oman','Paraguay','Peru','Philippines','Qatar','Rwanda','Saudi Arabia','Senegal','Singapore','Sudan'};listC={'Kuwait','Lebanon','Lesotho','Nepal','Netherlands','Oman','Sweden','Syria','Tanzania','Turkey','Uruguay'};%lists = {listA,listB,listC}; % storing data together makes working with them much simpler.%exc = lists{1};for k = 2:numel(lists) exc = intersect(exc,lists{k});endgiving the strings found in all cell arrays as: exc = 'Lebanon' 'Lesotho' 'Nepal' 'Netherlands' 'Oman'Now we can easily get the input cell arrays with the strings from exc removed:out = cell(size(lists));for k = 1:numel(lists) out{k} = setdiff(lists{k},exc);endgiving:>> out{:}ans = 'India' 'Iran' 'Ireland' 'Israel' 'Jordan' 'Kuwait' 'Libya' 'Luxembourg' 'Malawi' 'Maldives' 'Morocco' 'Norway' 'Paraguay' 'Peru' 'Philippines'ans = 'Denmark' 'El Salvador' 'Gabon' 'Gambia' 'Libya' 'Luxembourg' 'Malawi' 'Maldives' 'Morocco' 'Norway' 'Paraguay' 'Peru' 'Philippines' 'Qatar' 'Rwanda' 'Saudi Arabia' 'Senegal' 'Singapore' 'Sudan'ans = 'Kuwait' 'Sweden' 'Syria' 'Tanzania' 'Turkey' 'Uruguay'And if you want a list of all strings together, excluding those in exc:uni = {};for k = 1:numel(lists) uni = union(uni,lists{k});enduni = setdiff(uni,exc)gives:uni = 'Denmark' 'El Salvador' 'Gabon' 'Gambia' 'India' 'Iran' 'Ireland' 'Israel' 'Jordan' 'Kuwait' 'Libya' 'Luxembourg' 'Malawi' 'Maldives' 'Morocco' 'Norway' 'Paraguay' 'Peru' 'Philippines' 'Qatar' 'Rwanda' 'Saudi Arabia' 'Senegal' 'Singapore' 'Sudan' 'Sweden' 'Syria' 'Tanzania' 'Turkey' 'Uruguay' Related SolutionsMATLAB: How to plot Earth and drape a mesh with elevation data over it Dear future reader, this is the solution I found:Earth = wgs84Ellipsoid;axesm('globe','Grid','on','GlineStyle','-','Geoid',Earth)view(3)axis offload topotopo = topo / (1e-2); % The elevation can be exaggerated here meshm(topo,topolegend,size(topo),topo);demcmap(topo) MATLAB: Use comma as decimal seperator The answer is easy: no.Using the comma is a German feature. In the world of scientific computing the dot is always used as decimal separator. Only Excel is affected by this setting, and in consequence importing data from Excel to MATLAB can be substantially irritating. Related QuestionIssue creating a map of the USADisplaying names vertically on the x axisMust I change the geoid using UTM projectionWhen using listdlg to create a menu, how do you access the user input
Best Answer