MATLAB: Does MATLAB have operators like the “>” and “<" operators used in UNIX and DOS for input/output

cutMATLABshort

The "<" symbol in DOS and UNIX redirects input from the command line to a file. With the "<" symbol, if you have an executable called "prog" that expects several inputs from the user, you can put all these inputs on separate lines in a text file and have the computer get the inputs from the text file rather than the keyboard. Is there is a similar symbol in MATLAB?
Following is the "prog.m" code:
function prog
x=input('x=');
y=input('y=');
z=input('z=');
disp(sprintf('x=%e y=%e z=%e',x,y,z));
Following are the actual MATLAB command lines and outputs where the user has to enter the 30, 45, 60 values:
>> prog
x=30
y=45
z=60
x=3.000000e+001 y=4.500000e+001 z=6.000000e+001
Following are the MATLAB command lines I envision where the user only has to type the "prog < progins.txt" line below and not the 30, 45, 60 that appear after it:
>> prog < progins.txt
x=30
y=45
z=60
x=3.000000e+001 y=4.500000e+001 z=6.000000e+001
Following are the contents of "progins.txt":
30
45
60
Using the "<" symbol would let me automate certain functions that were designed to accept user input. I wouldn't need to make separate code for the user input way versus the automated way. I would have the computer emulate a human user by using the "<" symbol.
The UNIX or DOS ">" feature would also be useful. The ">" feature lets you redirect text output from the command window into a text file. Then you could do things like below in MATLAB:
>> prog < progins.txt > progouts.txt
progouts.txt would then contain:
x=30
y=45
z=60
x=3.000000e+001 y=4.500000e+001 z=6.000000e+001

Best Answer

The ability to use operators to redirect input and output to a file is not available in MATLAB.
To work around this issue, you can use the VARARGIN argument for the "prog" function and input a character symbol for the operator. For example, download the prog.m file attached below. This function gives the user 4 different options for redirection of input/output:
1. The user is prompted to enter the 3 values:
prog
2. The values are read from a text file:
prog '<' in.txt
3. The user is prompted to enter the 3 values, and the values are written to a text file:
prog '>' out.txt
4. The values are read from a text file and written to another text file:
prog '<' in.txt '>' out.txt