sponsor Vim development Vim logo Vim Book Ad

matlab_run.vim : Run matlab script using Python for Windows users

 script karma  Rating 7/3, Downloaded by 1057  Comments, bugs, improvements  Vim wiki

created by
Manu Hack
 
script type
ftplugin
 
description
I no longer use Matlab nor Windows so I won't be able to improve this script any more.  Feel free to take over it and improve it.  

Required Python and its module win32com.  
Only in win32 platform.

Known successful versions
WinXP, Python 2.4, Vim 7, Matlab 6.5

Please refer to tip#1298: http://www.vim.org/tips/tip.php?tip_id=1298
(Thanks for the improvement from the comments.)

How to use:
Type ,r then it will save your file and run the file in Matlab.  The output from Matlab will be displayed in the current window.

Remarks:
1. Work for function file as well as script file, as long as the function does not require inputs.

2. It will automatically add the path of your file using addpath in Matlab.  If you want to remove it you need to use rmpath in Matlab to do so manually. (Ignore this for version 1.1)

3. It may take longer time than usual when you open an m file because it also starts Matlab.

4. DO NOT close the Matlab Command Window.  It will close itself when you close your m files.

5. For those of you who don't have Python but consider to install it, I recommand the enthought edition (http://code.enthought.com/enthon/) which includes pywin32.  As a Matlab user, you may also find scipy and numpy very useful in the future.
 
install details
Download the file and put in $vim/vimfiles/ftplugin.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
matlab_run.vim 1.2 2006-08-31 7.0 Manu Hack Polish the script a little bit.  

In this version it won't open Matlab when you open an m file.  But need to open Matlab before running scripts.  

type ,o to open Matlab.
type ,r to run.  

Certainly you could map to your favorite keys.
matlab_run.vim 1.1 2006-08-11 7.0 Manu Hack This version does not add path.  You can also run m files in different directory now.
ip used for rating: 13.59.236.219

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github