6_pdfsam_3 - save data2.dat a -ascii This command causes...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: save data2.dat a -ascii This command causes each row of the array a (more on arrays later) to be written to a separate line in the data file. Array elements on a line are separated by spaces. The separating character can be made a tab with the command: save data2.dat a -ascii -tab The .mat extension is not added to an ASCII text file. However, it is recommended that ASCII text file names include the extension .dat so that it is easy to distinguish them from MAT-files and M-files (to be described in the next section). For an example of importing text data, suppose that a text file named data3.dat contains a set of values that represent the time and corresponding distance of a runner from the starting line in a race. Each time and its corresponding distance value are on a separate line of the data file. The values on a line must be separated by one or more spaces. Consider a data file named data3.dat containing the following: 0.0 0.0 0.1 3.5 0.2 6.8 The load command followed by the filename will read the information into an array with the same...
View Full Document

This note was uploaded on 03/07/2010 for the course ENG 101 taught by Professor Chang during the Summer '09 term at 東京国際大学.

Ask a homework question - tutors are online