Lecture6 - Data Files ■ MAT Files memory efficient binary...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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: Data Files ■ MAT Files-- memory efficient binary format-- preferable for internal use by MATLAB program ■ ASCII files-- in ASCII characters-- useful if the data is to be shared (imported or exported to other programs) MATLAB Input To read files in ■ if the file is an ascii table, use “ load ” ■ if the file is ascii but not a table, file I/O needs “ fopen ” and “ fclose ” ■ Reading in data from file using fopen depends on type of data (binary or text) ■ Default data type is “binary” Save Files ■ 8-digit text format (variable list) save <fname> <vlist> - ascii ■ 16-digit text format save <fname> <vlist> - double ■ Delimit elements with tabs save <fname> <vlist> - double - tabs Example : Vel = [1 3 5; -6 2 -3] save velocity.dat Vel-ascii 1.0000000e+000 3.0000000e+000 5.0000000e+000-6.0000000e+000 2.0000000e+000 -3.0000000e+000 Load Files ■ Read velocity into a matrix “velocity.dat” >> load velocity.dat >> velocity velocity = 1 3 5-6 2 -3 1.0000000e+000 3.0000000e+000 5.0000000e+000-6.0000000e+000 2.0000000e+000 -3.0000000e+000 ■...
View Full Document

{[ snackBarMessage ]}

Page1 / 12

Lecture6 - Data Files ■ MAT Files memory efficient binary...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online