osimlibdir = ' ''C:\OSim221\sdk\lib\';
simtklibdir = ' ''C:\OSim221\sdk\lib\';
include = [' -I''C:\OSim221\sdk\include'''...
           ' -I''C:\OSim221\sdk\include\xercesc'''...
           ' -I''C:\OSim221\sdk\include\SimTK\include'''];
libs=[osimlibdir 'osimSimulation.lib'''...
      osimlibdir 'osimCommon.lib'''...
      osimlibdir 'osimActuators.lib'''...
      osimlibdir 'osimTools.lib'''...
      osimlibdir 'osimAnalyses.lib'''...
      osimlibdir 'xerces-c_2.lib'''...
      simtklibdir 'OpenSim_SimTKcommon.lib'''...
      simtklibdir 'OpenSim_SimTKsimbody.lib'''...
      simtklibdir 'OpenSim_SimTKmath.lib'''...
      simtklibdir 'SimTKlapack.lib'''];
compilerFlags=[' -DWIN32'...
               ' -D_WINDOWS'...
               ' -D_CRT_SECURE_NO_DEPRECATE'];
mexcode=' osim.cpp';
eval(['mex' mexcode libs include compilerFlags])
