It is possible to use MATLAB with Xgrid. Until recently, every time I tried this, MATLAB either failed to start or would immediately die with a "bus error" after starting. However, I discovered through trial and error that Matlab simply requires that the HOME environment variable exists.
So the way to use MATLAB is to use a shell script that will set the environment variable correctly, then invoke MATLAB with a numerical argument. Read the rest of the hint for an example...
#!/bin/sh
# For some reason, MATLAB dies if you don't have
# HOME set in environment
export HOME=/home/username
X="foo(${1})"
/Applications/MATLAB7/bin/matlab -nojvm -nodisplay -r $X ;
As you see, you have to make sure you call MATLAB with the nojvm argument, or else it will complain about not being the console user. The -r argument lets you specify a function to run. In this example, the shell variable X is used to pass a different input argument, based on what Xfeed supplies from the range agument.function foo(in)
try
disp(['in was: ',num2str(in)])
% Now do something
A = [(in-1)*10+1:(in*10)];
disp(A)
catch
disp('Something went wrong')
disp(lasterr)
end
% It is critical that your task ends with "exit"
exit
< M A T L A B >
Copyright 1984-2004 The MathWorks, Inc.
Version 7.0.0.19901 (R14)
May 06, 2004
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
in was: 5
41 42 43 44 45 46 47 48 49 50
[robg adds: I haven't tested this one.]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20041125065000639