MATLAB: How do you create the number as mentioned below

homeworkpositive integersrow

If we write all positive integers in a row (in our decimal system) we get 123456789101112131415161718192021222324252627282930
Write a function that returns the n-th digit of this gigantic number.

Best Answer

Here it is
m=1:30;
n=12;
s=regexprep(num2str(m),' ','')
s(n)