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