For bash use export LD_LIBRARY_PATH= ...
%
% Boring loop
%
for iter = 1 : 10
fprintf('Hello, world again %d \n', iter);
end
To a function : hello.m as below
function hello
%
% Boring loop
%
for iter = 1 : 10
fprintf('Hello, world again %d \n', iter);
end
Now an example where we read in data from a file (MT.dat) so we can
easily change parameters.
We also write out data to another file to save the results (XX.dat)
function sde
randn('state',1000);
load MT.dat % load in a value for M and T
M=MT(1);
T=MT(2);
Dt=0.01;
K=T/Dt;
Db=zeros(K,M);
beta=zeros(K,M);
XX=zeros(K,M);
sdt=sqrt(Dt);
lambda=-1;
mu=1;
X=randn(1,5);
XX(1,:)=X;
for k=1:K
Db(k,:)=sdt*randn(1,M);
X = X + Dt*lambda*X + mu*X.*Db(k,:);
XX(k+1,:)=X;
end
time=(0:Dt:T)';
save -ascii XX.dat XX % save the output to use ;later
% For me the plot does not work
%plot(time,mean(XX,2),'b+-',time,XX);
This will read in MT.dat and write the computed data to ascii file XX.dat
Now an example with functions
1) You might want to put the output from the screen into a file.
EG in unix terminal type : nice sde2 > screen.txt &
(I think you can then log out and it will carry running and you don;t use anything ...)
2) For me figures do not seem to work on lxgabriel ... (it does on another)
3) There are some commands that are supposed not to work (eg cputime)
4) Compiling using mcc in the unix terminal keeps the matlab license for 30 mins.
5) Compiling using mcc in matlab keeps the matlab license until you quit. (So compile and then quit).
6) You might want to run the job in the background and 'niced' -- see examples 2 and 3 above
ssh into workstation
start screen
start your job as above
hit Ctrl-a d
logout of ssh
Email if any comments, corrections or additions.