function default(varargin)
param = [varargin{:} ';'];
ind = find(param=='=');
stmt = 'if ~exist(''%s'',''var'');%s;end';
str = sprintf(stmt,param(1:(ind(1)-1)),[varargin{:}]);
evalin('caller', str);
end
Example use
default x=2
Monday, November 04, 2013
Tuesday, October 22, 2013
Matlab text that scales with figure size
text(0.52,0.52,'52','FontUnits','normalized','FontSize',0.11)
Wednesday, August 28, 2013
Good observation
"Just as machine learning algorithms can overfit by tuning a classifier’s parameters to the
accidental properties of a training set, a research community can overfit by refining algorithms that
have already done well on the existing data sets"
Lewis, D. D.; Yang, Y.; Rose, T.; and Li, F. RCV1: A New Benchmark Collection for Text Categorization Research. Journal of Machine Learning Research, 5:361-397, 2004. http://www.jmlr.org/papers/volume5/lewis04a/lewis04a.pdf
accidental properties of a training set, a research community can overfit by refining algorithms that
have already done well on the existing data sets"
Lewis, D. D.; Yang, Y.; Rose, T.; and Li, F. RCV1: A New Benchmark Collection for Text Categorization Research. Journal of Machine Learning Research, 5:361-397, 2004. http://www.jmlr.org/papers/volume5/lewis04a/lewis04a.pdf
Wednesday, July 31, 2013
Monday, July 22, 2013
Matlab Keyboard function
keyboard function is useful for debugging purposes. It stops execution of m file and allows user to watch and manipulate variables.
Thursday, July 18, 2013
Reset Random Number Genaration of Matlab
reset(RandStream.getDefaultStream,sum(100*clock))
http://www.mathworks.com/support/solutions/en/data/1-18WH6/
http://www.mathworks.com/support/solutions/en/data/1-18WH6/
Wednesday, July 10, 2013
Matlab Jit Acceleration
- Avoid sparse matrices
- Avoid static variables
- Vectorize the code
- Use scalar values in range of for loops
- Only call built in functions in for loops
- http://www.ee.columbia.edu/~marios/matlab/accel_matlab.pdf
Monday, July 01, 2013
Moving file to folder in HG versioning system
Just copy files into desired directory. Go into that directory and right click. Go to hg->guess renames. Rest is straightforward.
http://kiln.stackexchange.com/questions/1943/moving-a-file-in-a-repository
http://kiln.stackexchange.com/questions/1943/moving-a-file-in-a-repository
Semi Turing Test
A loosely definition for semi-Turing test is whether a human is capable to understand an output from human and output from computer aided human. For example If I am using spell checker , how someone can understand that I am doing so. It requires much more effort to distinguish.
Tuesday, June 18, 2013
Monday, April 29, 2013
Wednesday, April 17, 2013
Wednesday, April 03, 2013
Matlab Long Simulation Interactive Debug , Set Debug flag using GUI , Pause execution to debug
Create a button function:
function util_DebugGuiButtons()
global debugFlag;
uicontrol('Position',[30 10 35 40],'String','||','Callback',@wait);
uicontrol('Position',[70 10 35 40],'String','>>','Callback',@dontwait);
function wait(hObject,eventdata)
debugFlag = 1;
end
function dontwait(hObject,eventdata)
debugFlag = 0;
dbcont;
end
end
Define in top of document:
global debugFlag
Put this inside your loop :
if (debugFlag)
dbstop in file.m at line
end
Continue Button is not working as desired now. It just clears the breakpoints but does not issue dbcont command properly. I will try to figure out later.
function util_DebugGuiButtons()
global debugFlag;
uicontrol('Position',[30 10 35 40],'String','||','Callback',@wait);
uicontrol('Position',[70 10 35 40],'String','>>','Callback',@dontwait);
function wait(hObject,eventdata)
debugFlag = 1;
end
function dontwait(hObject,eventdata)
debugFlag = 0;
dbcont;
end
end
Define in top of document:
global debugFlag
Put this inside your loop :
if (debugFlag)
dbstop in file.m at line
end
Continue Button is not working as desired now. It just clears the breakpoints but does not issue dbcont command properly. I will try to figure out later.
Sunday, March 17, 2013
Comments on variables
Matlab displays comments of functions when you tend to use it. It would be good if it can show the comment of variables while holding mouse on top of variable name. This way can provide a tool to remember what each variable if for without using long descriptive variable names.
Monday, March 11, 2013
Wednesday, March 06, 2013
mouse and pencil
While being a student my life is accomodated with two items mouse and pencil.So why we are not combining them . Put a wireless mouse pen to one side and put a pencil to other side. A gyro sensor can figure out if mouse is active.
Tuesday, March 05, 2013
Robot Dish Washer
It is difficult to create robot that cleans our arbitrary dirty dishes. However , if we put some digital information on dishes (special designed for this machine) such as RFID , than robot can easily understand the shape , coordinates and features of the dish. In this way it will be easy to optimize the placement of the dishes based on current dirty dishes information.
I imagine we can create machine that has two part , first part is regular dish washer and second part is open area for dirty dishes and attached robot hands at top. It will increase the size of the machine , but it may worth , especially for big restaurants.
I imagine we can create machine that has two part , first part is regular dish washer and second part is open area for dirty dishes and attached robot hands at top. It will increase the size of the machine , but it may worth , especially for big restaurants.
Friday, February 15, 2013
LDA PCA connection
"LDA can also be seen as a type of principal component analysis for discrete data"
http://www.cs.princeton.edu/~blei/papers/Blei2012.pdf
http://www.cs.princeton.edu/~blei/papers/Blei2012.pdf
Wednesday, February 06, 2013
MATLAB pass by reference
Handles handles the pass by reference issue in MATLAB.
http://www.mathworks.com/help/matlab/matlab_prog/copying-objects.html
http://www.mathworks.com/help/matlab/matlab_prog/copying-objects.html
Sunday, February 03, 2013
Monday, January 21, 2013
Thursday, January 03, 2013
Wednesday, January 02, 2013
Display Array in NetBeans
Netbeans uses GDB:
http://stackoverflow.com/questions/1651682/how-to-watch-a-c-dynamic-array-using-gdb
http://stackoverflow.com/questions/1651682/how-to-watch-a-c-dynamic-array-using-gdb
Subscribe to:
Posts (Atom)
AI
Despite the benefits of AI we are starving for humanity.
-
It is difficult to create robot that cleans our arbitrary dirty dishes. However , if we put some digital information on dishes (special des...
-
Our parents were arranging their schedule according to sunrise and sunset. They are still consistent in their habit. However, in our generat...
-
Robot Particles Display: Current display devices can show any image for a very cheap price. But it will be very intresting if someone tr...