Getting Started | ![]() ![]() |
The load Command
The load
command reads binary files containing matrices generated by earlier MATLAB sessions, or reads text files containing numeric data. The text file should be organized as a rectangular table of numbers, separated by blanks, with one row per line, and an equal number of elements in each row. For example, outside of MATLAB, create a text file containing these four lines.
16.0 3.0 2.0 13.0 5.0 10.0 11.0 8.0 9.0 6.0 7.0 12.0 4.0 15.0 14.0 1.0
Store the file under the name magik.dat
. Then the command
load magik.dat
reads the file and creates a variable, magik
, containing our example matrix.
An easy way to read data into MATLAB in many text or binary formats is to use Import Wizard.
![]() | Generating Matrices | M-Files | ![]() |