**matlab_test**,
a MATLAB code which
illustrates various features of MATLAB.

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

**matlab_test** is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.

matlab_calls_c, MATLAB codes which call a C function using the MEX facility.

matlab_commandline, MATLAB codes which illustrate how MATLAB can be run from the UNIX command line, that is, not with the usual MATLAB command window.

matlab_os, MATLAB codes which invoke an operating system command.

matlab_random_test, MATLAB codes which illustrate the use of Matlab's random number generators.

- matlab_test.sh, runs all the tests.

boolean_print_test shows how to print booleans as 'True' or 'False'.

- boolean_print_test.m, the code.
- boolean_print_test.sh, runs all the tests.
- boolean_print_test.txt, the output file.

character_to_string_test shows how to convert between MATLAB's character vector and string data types using convertCharsToStrings() and convertStringsToChars();

- character_to_string_test.m, the code.
- character_to_string_test.sh, runs all the tests.
- character_to_string_test.txt, the output file.

cpu_timing_test shows how you can measure the CPU time required for a given computation.

- cpu_timing_test.m, the code.
- cpu_timing_test.sh, runs all the tests.
- cpu_timing_test.txt, the output file.

factorial_recursive_test uses the standard example of the factorial function to demonstrate MATLAB's ability to implement a recursive function.

- factorial_recursive_test.m, the code.
- factorial_recursive_test.txt, the output file.

files_test shows how MATLAB can check whether a directory exists, and create it or remove it.

- files_test.m, the code.
- files_test.txt, the output file.

global_test shows how two functions can communicate the value of a variable, without using the argument list, by declaring the variable with a GLOBAL statement.

- global_test.m, the code.
- global_test.txt, the output file.
- global_test.png

hello_test is a simple example to print out "Hello, world!".

- hello_test.m, the code.
- hello_test.txt, the output file.

integer_print_test looks at how to print an integer array so that all the digits show up, without a scaling factor.

- integer_print_test.m, the code.
- integer_print_test.txt, the output file.

persist_test shows how a persistent variable can be used to "remember" the value of some variable within a function between calls.

- persist_test.m, the code.
- persist_test.txt, the output file.

RAND_TEST looks at how rand() generates uniform random values.

- rand_test.m, the source code;
- rand_test.txt, the output file;

RANDN_TEST looks at how randn() generates normal random values.

- randn_test.m, the source code;
- randn_test.txt, the output file;

RECURSIVE_TEST shows how you can use recursion in a function definition.

- recursive_test.m, the source code;
- recursive_test.txt, the output file;

spacing_test demonstrates that MATLAB can fail to interpret an arithmetic statement correctly because of the occurrence of a blank space. This occurs when creating a vector by listing entries. MATLAB allows the lazy practice of not separating entries by commas, and the result can be an error that is very hard to interpret.

- spacing_test.m, the code.
- spacing_test.txt, the output file.

STARTUP is a MATLAB script that can be used to initialize MATLAB. You have to know where to put it, though. (Hint: start MATLAB, and type "pwd" to find out where MATLAB starts by default. That's where you want to put this file.)

- startup_example.m, a simple startup file that moves MATLAB's current directory to a place that suits me better. Rename it to "startup.m".