<p>I would like MATLAB to tell me if I have an input file (.m file) that contains some variables with their numbers (i.e., <code>a = 5</code>, <code>b = 6</code>, <code>c = 7</code>) so that I can then use that .m file in another program (main .m file) that uses these variables to calculate <code>S = a + b + c</code>. How can I then read the input file from the main file? Assume the input file is called INP and the main MAIN.</p>

If your "input" file is an m-file, just use the name of the file in your "main" m-file.  For example you might have a file called input.m that looks like this:
```
```
% File: inputs.m
a = 5;
b = 6;
c = 7;
```
```
Then, you can use it in the file main.m like this:
```
```
% File: main.m
inputs;
S = a + b + c;
```
```