Functions by Categories

Brick Toolbox, Version 2.0 06-Jan-2017

Contents

ARRAY MANIPULATION

manipulate dimensions and shape
column, row, third, fourthReshape ND array to column vector, row vector, or vector in the 3rd or 4th dimension
matrix, threedReshape ND array to 2D or 3D array
fn_reshapepermuteFull capability for dimensions and shape manipulation
fn_add, fn_mult, fn_subtract, fn_div, fn_eqOperations between arrays whose dimensions only partially match
fn_indicesConvert between global and per-dimension indices
fn_interleaveInterleave data
fn_sizecompareCheck whether two size vectors are equivalent
apply function to elements of array or cell array
fn_mapApply a given function to the elements, columns or rows of an array (more versatile than Matlab arrayfun)
fn_findLook for non-empty elements, or which evaluate to true when applying a certain function
fn_isemptycWhich elements of a cell array are empty
fn_itemlengthsReturn lengths of all elements inside a cell array
simple processing
fn_bin, fn_enlargeData binning and enlarging
fn_roundRound x to the closest multiple of y
fn_coerceRestrict data to a specific range
fn_clipRescale data, restrict the range, color
fn_normalizeNormalize data based on averages in some specific dimension
min, max, mean,...
fn_min, fn_maxGlobal minimum or maximum of an array and its coordinates
fn_minmaxBasic min/max operations (e.g. intersection or union of 2 ranges)
fn_localmaxFind local maxima in a vector
fn_mean, fn_meansAverage over several dimensions, average successive argumments
fn_meancReturn mean and confidence interval
fn_meanangleAverage of angles (result in [-pi pi])
nmean, nmedian, nstd, nste, nrms, nsumTreat NaNs as missing values for mean/median/std/ste/rms/sum computations
fn_triggeravgLocal average of data around specific indices in a given dimension
fn_arrangepergroup, fn_avgpergroupReorganize an array according to labels describing a specific dimension, or average accross different repetitions of the same label
other
fn_symConvert a symmetric matrix to a vector and vice-versa
fn_timevectorConvert set of times to vector of counts and vice-versa

MATLAB TYPES

string
fn_strcutCut string into pieces according to specified separator
fn_strrepReplace several text sequences in string
structures
fn_structdispRecursive display of a structure content
fn_structmerge, fn_structcatMerge and concatenate structures
fn_structinitInitialize a structure with no field, or with same fields as a model
fn_structeditEdit a structure with a GUI interface; this is a wrapper of fn_control
conversions
fn_num2strConvert numeric to char, unless input is already char!, can return a cell array
fn_idx2strConvert indices to a compact string representation, e.g. '1:2 5:8' for [1 2 5 6 7 8]
fn_str2doubleConvert to numeric if not already numeric
fn_strcatConcatenate strings and numbers into a single string, with optional separator sequence
fn_floatConvert integer to single, keep single or double as such

PROGRAMMING

handy shortcuts
fn_switch, fn_castShortcut for avoiding using if/else and switch
fn_disp, fn_displayDisplay multiple arguments at once, display a variable name and value in a single line
fn_dispandexecDisplay commands in Matlab and executes them
fn_subsrefShortcut for calling Matlab subsref function
fn_ismemberstrCheck whether string is part of a set of strings (faster than Matlab ismember)
fn_flagsDetect flags in the arguments of a function
dealcAssign elements of an array to multiple outputs
fn_modReturn modulus between 1 and n instead of between 0 and n-1
fn_regexptokensGet the tokens of a regexp as a simple cell array
tools
fn_progress, pgPrint the state of a calculation
fn_hashUnique hash number for an array/cell/structure (Copyright M Kleder)
debugging
fn_dbstackDisplay current function name, with indent according to stack length
fn_basevarsLoad base workspace variables in caller workspace and vice-versa

FILES

shortcuts
fn_cdUser definition of shortcut to fast access directories
fn_fileparts, fn_fileextGet specific file parts, replace file extension
fn_lsReturn folder content
fn_mkdirCreate a directory if it does not exist
fn_movefileRename files in current directory using regular expression
user selection
fn_getfileSelect file and remember the containing folder of the last selected file
fn_savefileUser select file for saving and remember last containing folder
fn_getdirSelect directory and remember last containing folder
handy
locateReveal file in Explorer (Windows only)

IMPORT/EXPORT

read/save file
fn_readtext, fn_savetextRead/save text file
fn_readasciimatrix, fn_saveasciimatrixRead/save 2D array from/to text file
fn_readimg, fn_saveimgRead/save image or stack thereof, (read:) detects if color or grayscale, (save:) options for clipping, color map...
fn_readmovie, fn_savemovieRead AVI movie
fn_readxml, fn_savexmlRead/save XML file (Copyright Jarek Tuszynski)
fn_loadvar, fn_savevarLoad/save in MAT file in a more convenient way
read file
fn_readbinRead binary file containing some header followed by numerical data
save figure
fn_savefigSave figure with a number of options
Matlab workspaces
fn_exportvarExport data to a Matlab variable in base workspace

MATHEMATICS

filtering
fn_filtGaussian low-, high- or band-pass filtering using fft
fn_smooth, fn_smooth31D, 2D and 3D smoothing using Gaussian convolution
fn_detrendRemove a linear trend estimated only from specific indices
fn_spectrogramCompute spectrogram
optimization
fn_fitFit the parameters of a given function
dichotomyUses dichotomy method for one-dimensional optimization
statistics
fn_GLMtestPerform F-test and T-test in a GLM framework
fn_bootstrapCompare the mean or median of two ensembles using bootstrap method
fn_chi2indenpendencetestChi2 independence test
fn_pcorrectPerform correction for multiple testing
fn_sampleDraw samples from distribution
statistics + display
fn_regressionPerform linear regression and display data points and result
fn_comparedistribPerform a nonparametric test and display data points and results
fn_markpvalueDraw stars to mark significancy of results
machine learning
fn_clusteringPerforms correlation-based clustering of data x
tools
fn_fftfrequenciesFrequencies corresponding to the output of Matlab fft function

IMAGE PROCESSING

basic operations
fn_imageopApply a series of transformations to an image
fn_printnumberAdd small numbers and text to images or movies
regions of interest
fn_maskselectManual selection of a mask inside an image
fn_subrectManual selection of a rectangular mask inside an image
fn_poly2maskGet the mask of a polygon interior
fn_imvectConvert an image to a vector of pixels inside a mask, and vice-versa
fn_roiavgCompute average signal from a region of interest
coregistration
fn_registerCoregister images or movie
fn_xregisterFast fft-based coregistration at pixel (but not sub-pixel) resolution
fn_translate, fn_affinityInterpolate an image or movie after translation or affinity
GUI programs
fn_alignimageManual alignment of 2 images
montageManual alignment of a large set of images

DATA DISPLAY

shortcuts
fn_drawpolyShortcut for line(poly(:,1),poly(:,2))
figure
fn_figureRaise figures by name rather than by number (shortcut: ff)
fn_isfigurehandleIs handle a plausible figure handle
fn_subplotSubplots cover the figure without leaving any space
drawings
fn_arrowDraw an arrow
fn_circleDraw a circle
fn_linesDraw a series of vertical and/or horizontal lines
time courses displays
fn_stairsDisplay stairs in an intuitive way
fn_errorbarDisplay nice error bars
fn_regressionDisplay of data points together with linear regression
fn_spikedisplay, fn_rasterplotRaster plot display (display of punctual events as small bars)
time courses tools
fn_axisSet axis range for a better visual aspect than 'axis tight'
fn_nicegraphImprove aspect of graph display
fn_plotscaleAdd horizontal and vertical scale bars to graph
fn_linespecsHandle abbreviated plot options (e.g. 'r.')
special 2D displays
fn_displayarrowsDisplay an image and a velocity field on top of it
fn_tensordisplayDisplay of a field of 2x2 symmetric matrices using ellipses
2D tools
fn_imdistlineShow the distance between two points (enhanced version of Matlab imdistline)
fn_scaleScale bar for image display
color tools
fn_colorset, fn_colorbynameDifferent sets of colors, conversion between color numerical value and name
fn_showcolormapDisplay a color map in a given axes or in a separate figure
hsl2rgbConvert from Hue/Saturation/Luminance coordinates to RGB
movie displays
fn_playmovieSimple showing of a movie
fn_movieShow a movie, large number of options
mesh computations and displays
fn_meshplotDisplay a mesh
fn_meshselectpointDisplay a mesh and let user select a point with mouse
fn_cubemesh, fn_cubeviewRender the "faces" of a 3D data (creates a mesh and texture, or an image)
display ND data
fn_eegplot, fn_gridplotDisplay multiple time courses dispatched vertically or arranged as a grid
fn_framedisplayDisplay images arranged as a grid
interactive displays
fn_imvalueAutomatic link graphs and images for point selection and zooming
fn_reviewNavigate with arrow keys inside a set of data
fn_4DviewNavigation inside 3D, 4D or 5D imaging data

GUI PROGRAMMING

shortcuts
fn_evalcallbackEvaluate a callback, i.e. a char array, function handle or cell array
fn_get, fn_setGet and set mutiple properties of multiple objects at once
figure
fn_watchChange the pointer to a watch during long computations
panelorganizerDivide a figure into resizeable panels
object positions
fn_parentfigureGet parent figure
fn_pixelpos, fn_pixelsizePosition or size of an object in pixel units
fn_pixelposlistener, fn_pixelsizelistenerCreate a listnener detecting change in object position or size
fn_getposGet object position in a specific unit
fn_coordinatesConversion of screen/figure/axes, normalized/pixel coordinates
fn_controlpositionsSet an object position using a combination of absolute and relative (to any other object) coordinates
fn_setfigsizeChange the size of a figure, while keeping it within screen
fn_framedesignUtility to let user reposition graphic objects inside a figure
mouse actions
fn_buttonmotionExecute a task while mouse pointer is movedaround
fn_moveobject, fn_panMove a graphic object or navigate in graph with mouse
fn_mouse, interactivePolygonManual selection of a variety of shapes
fn_scrollwheelregisterDefine scrollwheel actions specific to which object the mouse is hovering over
pre-defined arrangements of controls
fn_okbuttonSmall 'ok' button waits to be pressed
fn_menuUtility to create a basic GUI made of a line of buttons
special controls
fn_multcheckSpecial control made of multiple check boxes
fn_buttongroupSet of radio buttons or toggle buttons
fn_sliderSpecial control that improves the functionality of Matlab slider
fn_sliderenhanceAllow a slider uicontrol to evaluate its callback during scrolling
fn_stepperEdit a numeric value, includes increment/decrement buttons
fn_sensorSpecial control whose value is changed by clicking and dragging
fn_clipcontrolA wrapper of fn_sensor that controls the clipping range applied to an image
fn_filecontrolSelect a file
elaborate controls
fn_controlArrangement of control that reflect the state of a set of parameters
fn_supercontrolSuper arrangement of control
fn_listorganizeEdit a list of strings or of structured data
dialogs
fn_reallydlgAsk for confirmtaion
fn_dialog_questandmemConfirmation question with an option for not asking again
fn_inputPrompt user for a single value. Function based on fn_structedit
GUI oriented-object programming
interfaceParent class to create cool graphic interfaces
fn_propcontrolCreate controls automatically linked to an object property
deleteValidDelete valid objects among the list of objects obj (particularly useful for Matlab graphic handles)
disableListenerMomentarily disable a listener (returns an onCleanup oject that reenable it when being garbage collected)

MISCELLANEOUS

shortcuts
aliasCreate command shortcuts
system
fn_lmstatGet information about how many Matlab floating licenses are used on the network
fn_hostnameReturn an identifiant specific to the computer in use
fn_emailSend e-mails from Matlab! Automatically attach figures, M-files and more
memory and pointers
whoisbigGet information about large variables
fn_getPrGet the address of the data stored in a variable: usefull to understand when two variables share the same data in memory
fn_pointerA structure that can be modified when being passed to functions
pointerImplement a pointer to any Matlab object
graphics
fn_figmenuAn automatic custom menu for figures: save figure, distance tool, ...
figure edition
fn_extractsvgdataExtract data from SVG file! (PDFs can be converted to SVG with InkScape free software)
fn_getcolorindicesExtract from image displays by checking the color bar
fn_color2bwGUI to let user choose the best conversion to convert color image to grayscale
fn_editsignalManually edit your signals data points!