MATLAB: Extracting digits from a number digits Hi, I have a column of numbers with the following format: 12345678 I want to extract digits 56 and digits 78 . in a way similar to the mid and right functions in excel . How can I do so? Best Answer a=[1234;12345678;3456];b=num2str(a);c=b(:,5:6)d=b(:,7:8)e=str2num(c)f=str2num(d) Related SolutionsMATLAB: Left 6 digits of a 9 digit number that could be incomple In vectorized form,num2str( floor(n(:)/10^3), '%.06d') MATLAB: Matching digits A=1234; B=1248; C =1238;Astr = num2str(A); %you'll need this one 3x so convert it once.idxstop = find(any(bsxfun(@ne,vertcat(Astr,num2str(B),num2str(C)),Astr),1),1,'first');common = Astr(1:idxstop-1) Related QuestionHow to convert these numbers to vector? size (1*1000)Left digitsVector of strings to cell arrayThree-digit formatConverting a Double into a Matrix of its DigitsExcluded Digits from vector
Best Answer