19. MATLAB Programming 1

19. MATLAB Programming 1 - ENGR 101 Section 100, Fall 10...

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

View Full Document Right Arrow Icon
ENGR 101 Section 100, Fall 10 M. Wellman 1 MATLAB Programming (Part I) ENGR 101, Lecture 19: 22 Nov 10 Announcements Project 7 due Wed 1 Dec Try to get done early, to avoid MATLAB license contention
Background image of page 1

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

View Full DocumentRight Arrow Icon
ENGR 101 Section 100, Fall 10 M. Wellman 2 Save/Load MATLAB provides facilities to save some or all of the current workspace state for later use. save mydata Stores all data in current workspace variables to a file named mydata.mat binary format readable only by MATLAB load mydata Restores all data from mydata.mat to current workspace Save/Load Selected Variables save mydata x y { } Stores data in specified variables to mydata.mat load mydata x y { } Restores data from specified variables from mydata.mat (if present) to current workspace
Background image of page 2
ENGR 101 Section 100, Fall 10 M. Wellman 3 Save/Load Procedure Syntax save( filename,var1,… ) Example: save('mydata','x','y') Stores data in specified variables to file with specified filename (using .mat as default extension) load( filename,var1,… ) Restores data from specified variables from specified file (if present) to current workspace Save to ASCII file save –ascii mydata.txt {vars } load assumes ASCII format unless extension is .mat Limitations Data must be (0/1/2)-dimensional character or data array All data is written as numbers Imaginary part of complex numbers is lost Variable names not saved If using load to read data, all items must have the same number of columns
Background image of page 3

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

View Full DocumentRight Arrow Icon
ENGR 101 Section 100, Fall 10 M. Wellman 4 General File I/O MATLAB manages file input/output through file IDs Numbers for tracking files used by a program To open a file: file_id_var = fopen( filename ); file_id_var
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/25/2011 for the course ENGR 101 taught by Professor Ringenberg during the Fall '07 term at University of Michigan.

Page1 / 16

19. MATLAB Programming 1 - ENGR 101 Section 100, Fall 10...

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