Loading data files
When performing a statistical analysis of a particular problem, you often have some data stored in a file. In Chapter 4, it was shown how you can save your variables (or the entire workspace) using different file formats and then load them back in again. Octave can, of course, also load data from files generated by other programs. There are certain restrictions when you do this which we will discuss here. In the following matter, we will only consider ASCII files, that is, readable text files.
When you load data from an ASCII file using the load
command (see Chapter 4), the data is treated as a two-dimensional array. We can then think of the data as a matrix where lines represent the matrix rows and columns the matrix columns. For this matrix to be well defined, the data must be organized such that all the rows have the same number of columns (and therefore the columns the same number of rows). For example, the content of a file called series.dat
can be:
1 232.1 334...