next up previous contents
Next: Optimization and Curve Fitting Up: Operating System Functions Previous: SETPATH Set Current Search   Contents

Subsections

SYSTEM Call an External Program

Usage

The system function allows you to call an external program from within FreeMat, and capture the output. The syntax of the system function is

  y = system(cmd)

where cmd is the command to execute. The return array y is of type cell-array, where each entry in the array corresponds to a line from the output.

Example

Here is an example of calling the ls function (the list files function under Un*x-like operating system).

--> y = system('ls m*.m')
y = 
  <cell array> - size: [3 1]
 
Columns 1 to 1
 mkhsetpath.m  
 mprintimage.m  
 mprintplot.m  
--> y{1}
ans = 
  <string>  - size: [1 12]
 mkhsetpath.m



Samit K. Basu 2005-03-16