function runx2(n)
%function runx2(n)
% Purpose: Simple demonstration of calling Fortran and C codes for 
%          multiplying an input, n, by 2. This program is used to 
%          demonstrate:
%          1) use of mex to compile C and Fortran codes
%          2) calling procedure of these C/Fortran mex files
%          3) use of mcc to generate standalone to run outside MATLAB
% Input:
% n -- this will be multiplied by 2
% Procedure:
% >> mex timestwo.F  % compile fortran file with F suffix
% >> mex times2.c    % compile C file
% Generate standalone with -m; non-m-files added to standalone with -a
% >> mcc -m runx2.m -a timestwo.mexa64 times2.mexa64
% Run executable runx2 outside of MATLAB
% scc1% runx2 5
% data passed with command syntax are strings; need conversion for double
if ~isdeployed, disp('Cannot run as m-file.'), return, end
n = str2double(n);
mf=timestwo(n);   % run fortran mex file to compute mf = n x 2
disp(['n = ' num2str(n) '  ;   mf = n x 2 = ' num2str(mf)])
mc=times2(n);     % run C mex file to compute mc = n x 2
disp(['n = ' num2str(n) '  ;   mc = n x 2 = ' num2str(mc)])
exit
