view m-toolbox/html_help/help/runcmd.m @ 39:11e3ed9d2115
database-connection-manager
Implement databases listing in database connection dialog
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − function runcmd(varargin)
+ −
+ − % This will run a shell command from within MATLAB using the given
+ − % arguments.
+ − %
+ − % usage: runcmd(varargin)
+ − %
+ − % varargin - a series of strings to be concatenated together.
+ − %
+ − %
+ − % e.g. >> runcmd('ls', '-l', dir);
+ − %
+ − % M Hewitson 16-07-04
+ − %
+ − % $Id: runcmd.m,v 1.2 2007/10/24 10:59:50 ingo Exp $
+ − %
+ −
+ −
+ − fid = fopen('tmpcmd', 'w+');
+ −
+ − fprintf(fid, '#!/bin/bash\n');
+ − fprintf(fid, 'export PATH=$PATH:${HOME}/bin\n');
+ − for j=1:nargin
+ − fprintf(fid, '%s ', varargin{j});
+ − end
+ − fprintf(fid, '\n');
+ −
+ − fclose(fid);
+ −
+ − !chmod +x tmpcmd
+ − !./tmpcmd
+ − %!rm tmpcmd
+ −
+ −