File Exchange

image thumbnail

Force Feedback Toolbox for MATLAB/Simulink

version (197 KB) by Chetan Jadhav
Force Feedback Toolbox (FFB) can be used with FFB devices and can create FFB effect objects.


Updated 19 May 2004

No License

A user can create a force feedback effect object in MATLAB workspace. Parameters used to define such objects are similar to those used in DirectX FFB effect structure. MATLAB maintains these FFB objects in its workspace and also the corresponding DirectX FFB effect structure using a DLL (C++ mex-function). This DLL incorporates DirectX functions and creates a linked list of DirectX effect structures. The effect objects in MATLAB can be manipulated within MATLAB and the changes are reflected in the corresponding effect structure in DLL. Toolbox contains commands to start, stop, and modify an effect. Presently, this toolbox can create eleven types of DirectX force feedback effects with envelope structure.

Additionally, the toolbox can read the X and Y angles of the device axis along with time stamp. Time information has adequate resolution to calculate time steps in microseconds. The time step can be used to estimate velocities and acceleration of the device axis.

Comments and Ratings (13)

Hi all,
I am a PhD scholar in the School of Electronics Engineering at Kyungpook Natioanal University in South Korea. My specialization is in Nonlinear Control applied in the field of Automotive applications specifically in Automated Driving and Shared Control.

Right now I am trying to use the toolbox (Force Feedback Toolbox) for implementing the Force Feedback through the Logitech G25 Steering Wheel in conjunction with Matlab Simulink version 2018. Everytime, I use the command directm('matlab'), I receive the error stating that

Error using directm (line 29)
Missing MEX-file directm.DLL

I have ensured that the Force Feedback Toolbox along with all its sub-folders are added to the Matlab root directory. Still, I always receive this error. Later on, I will be going ahead to use it in Simulink.

I would like to earnestly request you to kindly help me in suggesting the possible solution to address this error. Your help is greatly appreciated.



Works great. I had to change the DirectM.dll extension to .mexw32 (to get rid of a MATLAB warning) and change all the calls to DirectM in simeffect.m to the correct case (the "D" and "M" need to be capitalized) and it works great!



same error that was mentioned before:

Invalid MEX-file 'C:\Program
The specified module could not be found.

checked the directm.dll with dependency walker, which stated that the following files are missing:



getting the following error... any ideas?

>> directm('Matlab')
??? Invalid MEX-file 'C:\Program
Files\MATLAB\R2008a\toolbox\directm\directm\directm.dll': The specified module
could not be found.



Read my last comment. Create a figure window and then pass that to the function.


directm('Figure 1')

One thing I noticed is that you need to rename the directm.dll file as it unzips as DirectM.dll and the functions are expecting the lower case naming.

I can't get it to work. Its saying

??? Error using ==> directm at 29
Missing MEX-file directm.DLL

Error in ==> t at 1


Bryan Paton

The toolbox works fine it is just the documentation that is a little poor. You just need to pass the initialisation function an actual window name. The easiest way to do this is to call "figure" which creates a blank figure window before initialising the toolbox. The name of the newly created window will be "figure x" where is 1, 2, 3 etc depending on how many figure windows you have open. Once this is done you just create a new effect and start it. Very easy to control and gives you access to all the force feedback parameters.

kumar swamy

try it with tmas3206416DSK

amine hadj

There is problem within the file DirectM.m !! it does not work properly

Tim S


Igor Manovic

Nice work, great utility!!!

Rohit Thali

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

DirectM Toolbox/DirectM/

DirectM Toolbox/DirectM/@effect/

DirectM Toolbox/Examples/

DirectM Toolbox/Examples/