MasterScan
Lab_Matlab_control Master Branch
|
Functions | |
benchmarkStructVsMap (n) | |
Check performance of different Matlab data structures. More... | |
fileList | findFiles (folder, fileFilter) |
Locate files at or below the given folder. More... | |
colors | puebloColors (n) |
Get a colormap with bold, Earthy colors. More... | |
colors | spacedColors (n) |
Get a colormap with evenly-spaced colors that show up against white. More... | |
subpos | subposition (position, r, c, ii, jj) |
Get a rectangular sub-region of a rectangle. More... | |
t | topsClock () |
Get the current time as a number. More... | |
topsPath | topsRoot () |
Get the absolute path to the Tower of Psych project root. More... | |
didPass | topsRunTests (fileFilter) |
Invoke Tower of Psych unit tests at or below the current folder. More... | |
benchmarkStructVsMap | ( | n | ) |
Check performance of different Matlab data structures.
n | the number of items to try adding to each data structure @ details Adds n values to a struct, and to a containers.Map object. Measures how long it takes to add the values, and how long it takes to access them. Plots a summary in the gcf() figure. |
fileList findFiles | ( | folder | , |
fileFilter | |||
) |
Locate files at or below the given folder.
folder | path where to start looking for files |
filter | optional regular expression for filtering files |
findFiles() recursively searches folder and its subfolders for files. If folder is omitted, uses pwd(). By default, returns all files. fileFilter may contain a regular expression, in which case only files whose names match @fileFilter are included. Matching is performed on full, absolute path names.
Ignores subfolders that contain '.'. Ignores files that start with '.' or end with "~" or "ASV".
Returns a cell array of string which are the full, absolute path names of files that were found and matched.
Here are some examples: allMatlabFiles = findFiles(matlabroot); myDataFiles = findFiles(myFolder, 'data');
colors puebloColors | ( | n | ) |
Get a colormap with bold, Earthy colors.
n | the length of colormap to build |
Returns an nX3 colormap with rows of the form [R G B], and components in the range 0-1.
The "Pueblo" colors are inspired by the art work in Gerald McDermott's book Arrow to the Sun (http://en.wikipedia.org/wiki/Arrow_to_the_Sun). There are only a few unique colors in this color map. If n is larger than the number of colors, they are repeated.
Most of the "Pueblo" colors are on the red side of the spectrum. They show up well against black.
Here's a demo:
colors spacedColors | ( | n | ) |
Get a colormap with evenly-spaced colors that show up against white.
n | the length of colormap to build |
Returns an nX3 colormap with rows of the form [R G B], and components in the range 0-1.
Here's how spacedColors() picks evenly-spaced colors that show up against white: it uses a cube with sides in the interval [0 1]. It treats each cube dimension as a color component. Thus, any point in the cube can be interpreted as an RGB color.
Colors near the [1 1 1] corner will be close to white, so they won't show up against a white background. spacedColors() truncates the cube by cutting off points near [1 1 1]. It picks n colors from the rest of the cube, by taking evenly-spaced strides. The smaller n, the greater the spacing between colors.
Here's a demo:
subpos subposition | ( | position | , |
r | , | ||
c | , | ||
ii | , | ||
jj | |||
) |
Get a rectangular sub-region of a rectangle.
postion | 1x4 matrix that defines a rectangle, [x y w h] |
r | the number of rows to divide position into |
c | the number of columns to divide position into |
ii | the row index of the desired sub-region |
jj | the column index of the desired sub-region |
Returns an array of the form [x y w h] which defines the rectangular subregion found at the iith row and jjth column of position.
subposition() is similar to the Matlab's built-in subplot(), but it operates on position rectangles (that is, arrays) rather than Matlab graphics objects.
t topsClock | ( | ) |
Get the current time as a number.
Returns the time in seconds since topsClock() was first called. topsClock() uses a private instance of Matlab's builtin tic()-toc() stopwatch.
topsPath topsRoot | ( | ) |
Get the absolute path to the Tower of Psych project root.
If Tower of Psych is on the Matlab path, returns an absolute path string to where Tower of Psych is located.
didPass topsRunTests | ( | fileFilter | ) |
Invoke Tower of Psych unit tests at or below the current folder.
fileFilter | optional regular expression to filter test files |
Runs unit tests for Tower of Psych. Searches the current folder and subfolders for files whose names begin or end with "test" or "Test", and executes any Matlab xunit tests they define. If fileFilter is supplied, limits tests to those files that match fileFilter.
Attempts to avoid sequential effects by invoking multiple "clear" statements between test files.
If all unit tests are successful, returns true. If any unit test fails, aborts and returns false.
Here are some examples: isOK = topsRunTests(); isFoundationOK = topsRunTests('foundation');