MATLAB: Select specific digits of a number dataindexingMATLAB How can I select specific parts of a number? For example if we have x=953, I want to select specifically the first digit (or the last two) and save it in another variable, so the outcome would be y=9 (or y=53) Thanks Best Answer x = 953d = 100r = mod(x, d) % 53y = (x - r) / d % y = 9 Related SolutionsMATLAB: The Data Tip Text Update Function I think it should be:output_txt{end+1} = ['X: ',num2str(x,4)]; MATLAB: Convert a string of numbers to a number. You can use the following code.a=[1 2 3];b=length(a);c=(b-1):-1:0d=10.^c;y=a.*d;It converts an array containing digits to a number.Hope that helps. Related QuestionAddition of numbers in array
Best Answer