Sonntag, 4. August 2013

Matlab and running real-time experiments

Don't DO IT. That's all I can say. I think Matlab is a nice tool but not to create and run experiments. Especially not Real-Time ones where time and memory is really important. I still don't really understand why still so many scientists still use Matlab to program an experiment. I gave up on that and will concentrate more on either Python, Java or something else.

Donnerstag, 4. Juli 2013

MATLAB and Mex files

Hello fellows

I tried to write my own C/C++ codes for Matlab using the Mex compiler. My challenge was to use MinGW and third party libraries.
First Matlab's Mex compiler doesn't support that. After searching the web, everyone will find the GnuMex project which can be used to that. My main problem was and I still don't know why, I couldn't use my own programmed libraries. Somehow the -L and -l command doesn't work. The Mex compiler with the help of GnuMex couldn't help me. Maybe because I'm using a 64 bit Windows 7.
Anyway, here is my fix:
Don't use them at all !

Just use your own familiar UI programming framework and the following information:

  • Create a shared library project. The suffix should be changed to .mexw32.
  • Use additionally to your include paths this one: C:\MATLAB\R2007b\extern\include. Change the path to your Matlab installation folder of course.
  • Use additionally to your library paths this one: C:\MATLAB\R2007b\bin\win32. Don't use the on in this folder:  C:\MATLAB\R2007b\\extern\lib\win32\microsoft. Here goes the same. Change the path to your Matlab installation folder.
  • Add the following libraries to your project: mex, mat, mx. As you already know we don't have to use the prefix lib, for example libmex.dll. The GCC linker will do that for you. Just use it without the prefix and the -l command. 
  • Use for the C/C++ Preprocessor the define macro MATLAB_MEX_FILE
I hope I didn't forget anything. With that you can use Makefiles, Eclipse, Codelite etc. with your MinGW under windows without messing around with text editors and the Mex Compiler of Matlab.

Freitag, 14. Juni 2013

Shared folders with VirtualBox

  1. Go to the VirtualBox VM menu ->Devices->Shared Folders ...
  2. Click the add folder button on the right side.
  3. On the "Select folder path" (SFP) select the folder on your host machine
  4. On the "Select folder name" (SFN) write the name you want to use later if you have to mount the drive.
  5. Click the OK button.
  6. Open a terminal window and run this command: sudo mount -t vboxsf SFN mountpath
  7. Now you should have access to your shared folder.
 If you made the shared folder permanently mounted you don't have to do the steps above. Just put your account into the vboxsf group and you can access the folder in the /media/ folder of your system.