In Matlab, let's say that I have the following string:
mystring = 'sdfkdsgoeskjgk elkr jtk34s ;3k54352642 643l j3kf p35j535';
And I want to extract all the digits in it to a vector such that each digit is standing by its own, so the output should be like:
output = [3 4 3 5 4 3 5 2 6 4 2....]
I tried to do it using this code and regex:
mystring = 'sdfkdsgoeskjgk elkr jtk34s ;3k54352642 643l j3kf p35j535';
digits = regexp(mystring, '[0-9]');
disp(digits);
But it gives me some weird 4-combined digits instead of what I need.