MATLAB: Filter a cell array with words filter words cell array Hi, assume you have the cell array{1,1} with a text called "XXXX-adsaads". I want the the portion -adsaads to be removed so that I only get XXXX. How can I do this? Best Answer trimedcell = regexprep(YourCellArray, '-.*', '', 'once'); Related SolutionsMATLAB: Read part of string This will work, but no guarantee that it will easily generalise to more complicated situations:name(1,1) = {'Italy'};name(2,1) = {'Rome, Italy'};x = findstr(name{2},',');y = name{2}(1:x-1)produces:y =RomeThis is only one way (and probably the simplest). There are many others. MATLAB: How to find the index of a known number? (reverse indexing?) idx = find(M==xxxx) Related QuestionHow remove from a cell array, the words in an other cell arrayRemove zeros in a table
Best Answer