Revision 272, 0.9 kB
(checked in by smidl, 15 years ago)
|
Examples
|
Rev | Line | |
---|
[272] | 1 | /*! |
---|
| 2 | \page itfile Writing and reading data from files |
---|
| 3 | |
---|
| 4 | Here we will use the \c it_file class to store some data. The program \c |
---|
| 5 | write_it_file.cpp looks as follows: |
---|
| 6 | |
---|
| 7 | \include write_it_file.cpp |
---|
| 8 | |
---|
| 9 | When you run this program you will obtain a file called \c it_file_test.it |
---|
| 10 | in your current directory. You can read the file into Matlab/Octave to view |
---|
| 11 | the data by using the following commands: |
---|
| 12 | |
---|
| 13 | \code |
---|
| 14 | itload('it_file_test.it') |
---|
| 15 | figure(1); clf; |
---|
| 16 | plot(a) |
---|
| 17 | \endcode |
---|
| 18 | |
---|
| 19 | Note: Make sure that <tt>$PREFIX/share/itpp</tt> is in your Matlab/Octave |
---|
| 20 | path and that you run the code above from the directory where \c |
---|
| 21 | it_file_test.it is located (\c $PREFIX is the IT++ installation prefix; |
---|
| 22 | <tt>/usr/local</tt> by default). |
---|
| 23 | |
---|
| 24 | The IT++ program \c read_it_file.cpp that reads the file and prints its |
---|
| 25 | content can look like this: |
---|
| 26 | |
---|
| 27 | \include read_it_file.cpp |
---|
| 28 | |
---|
| 29 | Here is the output of the program: |
---|
| 30 | |
---|
| 31 | \verbatim |
---|
| 32 | a = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] |
---|
| 33 | \endverbatim |
---|
| 34 | */ |
---|