MATLAB: Excluded Digits from vector matchstring vector=[1 2 5 13 55 23 15],excluded dig=5 then out=[1 2 13 23] ,another example vector=[3 24 7 9 18 55 67 71],excluded dig=7 then out=[3 24 9 18 55] Best Answer I expect there is a much cleaner method, but here is one that works:vector = [1 2 5 13 55 23 15];exDigit = 5;v = vector;hasDigit = false(1,numel(v));while max(v>=1) hasDigit = hasDigit | mod(v,10)==exDigit; v = floor(v/10);endnew_vector = vector(not(hasDigit)) Related SolutionsMATLAB: Join numbers in vector x=[13 30 44 12 44 23 12];stringX=num2str(x);stringX=stringX(stringX~=' '); % remove the spacex2=str2num(stringX); MATLAB: How to randomly change a digit in a string string1 = '00101';digit_change = randi(length(string1));digit_val = str2num(string1(digit_change));digit_new = num2str(~digit_val);string1(digit_change)=digit_new; Related QuestionTricky correction of faulty time listWhat toolboxes are accessible within CodyWhat is the fastest and most elegant way to calculate permutations of a vector of numbersHaving issue after downloading tabular data from web.Simple wild card function for ismember?
Best Answer