a=cell(dim)
...this is a log of code snippets and useful tips I wrote/found. Should you find any mistakes or have any useful suggestions, please do not hesitate to write to me.
Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts
Tuesday, April 8, 2014
Tuesday, January 28, 2014
Things to remember when using parfor
This website from matlab:
http://www.mathworks.com/help/distcomp/programming-considerations.html
-- cannot use clear inside the loop
specifically:
=========
Similarly, you cannot clear variables from a worker's workspace by executing clear inside a parfor statement:
http://www.mathworks.com/help/distcomp/programming-considerations.html
-- cannot use clear inside the loop
specifically:
=========
Similarly, you cannot clear variables from a worker's workspace by executing clear inside a parfor statement:
parfor ii= 1:4 <statements...> clear('X') % cannot clear: transparency violation <statements...> endAs a workaround, you can free up most of the memory used by a variable by setting its value to empty, presumably when it is no longer needed in your parfor statement:
parfor ii= 1:4 <statements...> X = []; <statements...> end=============
Wednesday, October 9, 2013
using nohup
nohup matlab -nodisplay -nosplash -r Script1 > out.txt &
Edit
f you want to run a function with variables, this is how to do it:
nohup matlab -nodisplay -nosplash -r "funcitonabcc(var1,var2,..,varn); exit; " > out.txt &
the text within the double quotes needs to be written just as you would call commands in matlab.
Edit
f you want to run a function with variables, this is how to do it:
nohup matlab -nodisplay -nosplash -r "funcitonabcc(var1,var2,..,varn); exit; " > out.txt &
the text within the double quotes needs to be written just as you would call commands in matlab.
Friday, September 20, 2013
Substringing in matlab
Many functions in matlab let you do various things to strings
strtok(s,delim)
returns the substring before delim
[first,rem]=strtok(s,delim)
first the substring before delim
rem the substring s-first(it includes delim)
strrep(s,'a','b')
replaces a with b in s
strtok(s,delim)
returns the substring before delim
[first,rem]=strtok(s,delim)
first the substring before delim
rem the substring s-first(it includes delim)
strrep(s,'a','b')
replaces a with b in s
Subscribe to:
Posts (Atom)