About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
  • License: Freeware
  • Last update: 5 years ago
  • Total downloads: 51
  • Price: Free |
  • Operating system: Linux, Mac OS X, Win All, BSD, Solaris
  • Publisher: Jean-Yves Tinevez (4 other programs)
See full specifications

scripts default iconcheckfield (Scripts) Publisher's description

CHECKFIELD intend to be a facility to handle varargin in functions.

CHECKFIELD intend to be a facility to handle varargin in functions. It provides error checks, default, and structuring for the varargin.

k = CHECKFIELD(field,listfield) where field is a string checks if field is one of the fields in the cell listfield given in second argument. It returns the index of the found field in the list if successful.

K = CHECKFIELD(argin,listfield) where argin is a cell of arguments pair, first checks if field/value come by pair, and then if the fields are in the cell listfield given in second argument. It returns the array of index of the fields in the list if successful.

S = CHECKFIELD(field,value,TESTVALID) checks the contents of the specified value to be valid for the field 'field', by applying it to the function handle TESTVALID, which must be a function that returns a boolean.

S = CHECKFIELD(field,value,TESTVALID,ACCEPTABLEVALUES) also checks the contents of the specified value to be within a cell array given by ACCEPTABLEVALUES.

S = CHECKFIELD(argin,listfield,...) where all of these arguments are cells, does all these tests for each pair field/value.

The three later syntaxes return a struct for which each field as for name the name of the given field and for value the value checked.

S = CHECKFIELD(argin,listfield,...,S) does the same, but updates the previous fields of S (which can be e.g. defaults) with the new values checked.

All values can be cell array. In this case, the testvalid is applied to each cell element, and the corresponding field in the returned struct is a cell.

Suppose you are writing a m-file that would take variable argument number (varargin):
function M = getimagenames(varargin)

listfields = { ...
'First' };

testvalid = { ...
@ischar, ...
@(i) iswhole(i) & i>0 };

acceptablevalues = {
{'Range', 'All', 'Index'}, ...
{} };

default = struct( ...
'method','all', ...

S = checkfield(varargin,listfields,testvalid,acceptablevalues,default);

S is now a struct with fields 'Method' and 'First' whose value are default unless the user entered new values for them, such as with getimagenames('first',3)

See also: VARARGIN

Author: Jean-Yves Tinevez
Work address: Max-Plank Insitute for Cell Biology and Genetics,
Dresden, Germany.
Email: tinevez AT mpi-cbg DOT de
November 2007;
Permission is given to distribute and modify this file as long as this notice remains in it. Permission is also given to write to the author for any suggestion, comment, modification or usage.

System Requirements:

MATLAB 7.5 (R2007b)
Program Release Status: New Release
Program Install Support: Install and Uninstall

Is checkfield (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.