%% Convert MATLAB Character Array to Uppercase
% This example shows how to pass a MATLAB character array str to a C function,  stringToUpper.

str = 'This was a Mixed Case string';

%
% Load the library containing the stringToUpper function.

if not(libisloaded('shrlibsample'))
    addpath(fullfile(matlabroot,'extern','examples','shrlib'))
    loadlibrary('shrlibsample')
end

%
% Pass str to the function.

res = calllib('shrlibsample','stringToUpper',str)

%
% The input parameter is a pointer to type char. However, a MATLAB character array is not a pointer, so the stringToUpper function does not modify the input argument, str.

str

%
% Copyright 2015 The MathWorks, Inc.