Programming and Data Types    

Command/Function Duality

MATLAB commands are statements like

Many commands accept modifiers that specify operands.

An alternate method of supplying the command modifiers makes them string arguments of functions.

This is MATLAB's command/function duality. Any command of the form

can also be written in the functional form

The advantage of the functional approach comes when the string argument is constructed from other pieces. The following example processes multiple data files, August1.dat, August2.dat, and so on. It uses the function int2str, which converts an integer to a character string, to help build the filename.


 String Evaluation Empty Matrices