Skip to content

Instantly share code, notes, and snippets.

@vaibhaw
Last active August 29, 2015 14:10
Show Gist options
  • Save vaibhaw/31a373fe676170536d1b to your computer and use it in GitHub Desktop.
Save vaibhaw/31a373fe676170536d1b to your computer and use it in GitHub Desktop.
% add and remove path
addpath(folder_name)
% generate recursive paths within a folder
genpath(folder_name)
% add all sub-directories in MATLAB path within a folder
addpath(genpath(folder_name))
### Comment
%{
Stuff to be commented out
%}
% create an array of empty matrices
% an N-by-N cell array of empty matrices.
cell(N)
% an M-by-N cell array of empty matrices.
cell(M,N) % or
cell([M,N])
% M-by-N-by-P-by-... cell array of empty matrices.
cell(M,N,P,...) % or
cell([M N P ...])
% cell array the same size as A containing all empty matrices.
cell(SIZE(A))
% start time counter
tic
% stop time counter
toc
% getting folder name, filename and extension from a filepath
[pathstr,name,ext] = fileparts(filename)
% check if an element is a member of a cell or not
[present, pos] = ismember(im1, images);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment