%% Count Elements Found in Text
% Create a string that contains numbers separated by whitespace characters. Count the elements that sscanf puts into the output array when it converts the string to numbers.
% Starting in R2017a, you can create strings using double quotes.

str = "78 72 64 66 49"

%
% Count the elements in the output array A. Convert the numbers in the string using the %d operator. %d matches integers separated by whitespace. To return the number of elements in A, specify a second output argument.

[A,n] = sscanf(str,'%d')

% Copyright 2012 The MathWorks, Inc.