Examples
- Create a data file with the following values:
1 2 3 4 5 3429 23423 23423 234 93402
- Save the file as
data.txt
. - Create a new program script.
- Save the new file as
file_input_demo.m
- Add a line of code to
file_input_demo.m
that loads the data values into a variable.
The load command can save the content a variable with the same name as the file:
load data.txt
or to a new name for the variable by enclosing the file name in quotes and assigning the results to the new variable name.
my_data = load( 'data.txt' )
- Create a data file with the following values: