%% Return Last Position Scanned
% Create a character vector and read data from it. When sscanf fails to convert all of the input, return the index that immediately follows the position at which sscanf stopped. Use this index to display the unscanned input.

chr = '3.14159 are the first 6 digits of pi'

%
% Convert the data in chr. Return the index.

[A,~,~,nextindex] = sscanf(chr,'%f')

%
% Display the characters from chr that sscanf did not scan.

chr(nextindex:end)

% Copyright 2012 The MathWorks, Inc.