HyperGraph

MATLAB Interface

MATLAB Interface

Previous topic Next topic Expand/collapse all hidden text  

MATLAB Interface

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

MATLAB DLL functions created by the MATLAB Compiler on Windows PCs can be registered as math functions in HyperGraph 2D.  To use the math functions, MCR must be installed on the machine running HyperWorks.

How do I...

hmtoggle_plus1Compile MATLABFn:

Requirements:

'make' command
Appropriate C/C++ compiler (see Further Details)
Appropriate linker (see Further Details)
1.Edit the makefile.

The makefile is located in /altair_home/tutorials/mv_hv_hg/plotting/MatlabFn.

The 'MCR_ROOT' and 'IPC_ROOT' variables are initially blank and must be set to the appropriate directory.  The MCR_ROOT root directory should point to the installation path of the Matlab Compiler Runtime (MCR) package on the current platform.  This directory should, at a minimum, contain the files extern/include/mclmcr.h, other Matlab include files, and lib/[PLATFORM_ID]/libmwmclmcrrt.[sl/so].7.3. The IPC_ROOT variable should point to the installation path of the Altair IPC library and header files for the HyperWorks package.  The default installation location is [ALTAIR_HOME_DIRECTORY]/altair/io/ipc_functions. This directory should contain include/[PLATFORM_ID]/altair_ipc.h and lib/[PLATFORM_ID]/libipclib.a.

2.Run make.

Your system must have a make utility installed.  If you cannot run the make utility, check with your system administrator to verify if one is installed and its location.  Your PATH environment variable must include the location of make.

3.If the required compiler and linker are in your PATH environment variable, the MatlabFn project will build.

At this point, you may receive error messages if the compiler and linker are not installed and in your PATH variable. Check with your system administrator to find the required linker and compiler and install them in your PATH. For example, on the HP platform, /usr/bin/cc and /opt/aCC/bin must be in PATH to compile and link.

4.Once matlabfn.exe is built, you can register it in your user preference file, along with your MATLAB Compiler DLL math functions, using *RegisterExternalDLLFunction("Math Function Name", "Path to DLL", "Path to compiled MatlabFN.exe", "Number of Arguments for DLL", "Number of Outputs from DLL"). See *RegisterExternalDLLFunction() in the MotionScript on-line help for more information.

Further Details

See the platform-specific sections of the make file for the compiler and linker requirements for each particular platform.  Using other compilers and linkers may or may not work properly.  This requirement is imposed by Altair's use of various third-party libraries which have their own compiling and linking requirements.  Since the MatlabFn project uses the libipclib.a library that is compiled by Altair and linked to Altair products, those compiler/linker requirements carry forward into the MatlabFn project.

See Also:

*RegisterExternalDLLFunction() in the MotionScript on-line help.