%% Determine If Array Is String Scalar
% Create different arrays, and then determine if they are string scalars.
% Test a string scalar.

str = "Mercury"

%

tf = isStringScalar(str)

%
% Test a string array with multiple elements. Since str contains more than one element, isStringScalar returns 0.

str = ["Mercury","Gemini","Apollo"]

%

tf = isStringScalar(str)

%
% Test a character vector. Since character vectors are not strings, isStringScalar returns 0.
%

chr = 'Pluto'

%

tf = isStringScalar(chr)

% Copyright 2012 The MathWorks, Inc.