Skip to content
Sample combination of Veins and MATLAB
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings Initial commit May 31, 2019
examples/veins_matlab Initial commit May 31, 2019
images Initial commit May 31, 2019
matlab Initial commit May 31, 2019
src Initial commit May 31, 2019
.clang-format Initial commit May 31, 2019
.cproject Initial commit May 31, 2019
.gitignore Initial commit May 31, 2019
.nedexclusions Initial commit May 31, 2019
.nedfolders Initial commit May 31, 2019
.oppbuildspec Initial commit May 31, 2019
.oppfeaturestate Initial commit May 31, 2019
.project Initial commit May 31, 2019
.uncrustify.cfg Initial commit May 31, 2019
COPYING Initial commit May 31, 2019
Makefile Initial commit May 31, 2019
README.md README Jun 9, 2019
configure Initial commit May 31, 2019
format-code.sh Initial commit May 31, 2019

README.md

veins_matlab

Sample combination of Veins and MATLAB

Supported program versions

Supported platforms

  • Windows 10
  • Ubuntu 18.04
  • macOS 10.14

Setup

First, make sure that you are using compatible program versions (see above) on a compatible platform (see above).

Make sure that MATLAB is set up and working.

Open MATLAB. Within MATLAB, change to the matlab/ subdirectory of veins_matlab. If you are using Windows, make sure to open MATLAB from the Start Menu or Explorer (do not open MATLAB from an OMNeT++ shell, as this changes environment variables that session sharing will rely on to work).

In MATLAB, open the init.m file and run it. This will set up a shared session called veins.

Also, make sure that Veins is set up and working from the command line by opening an OMNeT++ shell, navigating to the Veins directory, and executing ./configure followed by make. Change to the examples/veins subdirectory and run ./run to confirm Veins is working. Use the same command line window for entering any of the following commands.

In the command line window, change to the veins_matlab directory.

Determine where your installation of MATLAB is located. The directory you are looking for will contain a file VersionInfo.xml and should be one level up from where the matlab (or matlab.exe) binary is located. Pass this path as an argument to ./configure --with-matlab=..., similar to one of the following lines:

./configure --with-matlab=/opt/matlab/R2019a
./configure --with-matlab=/Applications/MATLAB_R2019a.app
./configure --with-matlab=/c/ProgramFiles/MATLAB/R2019a

Build veins_matlab by running

make

Try out veins_matlab by running

cd examples/veins_matlab
./run -u Cmdenv

You should see the following output (amidst other OMNeT++ output):

[INFO] General:0 MATLAB result is 11
[INFO] General:0 MATLAB result is 12
[INFO] General:0 MATLAB result is 13

Bugs

  • Building with MATLAB installed in a location containing spaces is not supported. Creating a symlink (on Windows: a directory junction, that is, running something like mklink /J ProgramFiles "Program Files") can work around this bug.

  • Running in debug mode appends _dbg to the library names of MATLAB as well. This means, OMNeT++ will try to load libraries libMatlabDataArray_dbg and libMatlabEngine_dbg. Creating a symlink from (or simply copying), e.g., libMatlabEngine.dll to libMatlabEngine_dbg.dll can work around this bug.

You can’t perform that action at this time.