12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

q =7 8 96 1 25 4 3>> save saved_data_text -ascii>> clear>> load saved_data_text>> whosName Size Bytes Classsaved_data_text 3x3 72 double arrayGr<strong>and</strong> total is 9 elements using 72 bytes>> saved_data_textsaved_data_text =7 8 96 1 25 4 3The data is loaded as a variable with the same name as the file name(no information about variable names are stored in the file).30.2 Other FormatsYou may be presented with some data written by another piece <strong>of</strong> s<strong>of</strong>twarethat you want to load into matlab. In this case you have thefollowing options:1. You can write a translation program in another language (C orfortran for example) that reads in the data <strong>and</strong> then writes it toanother file that can be read into matlab—that is, a mat-file.2. You can write a matlab-callable program (mex-file) that readsin the data <strong>and</strong> returns appropriate variables in the matlabworkspace. This is a good option if you already have code to readin the data.3. You can use one <strong>of</strong> the functions for reading in st<strong>and</strong>ard file formatsfor images, sounds, spreadsheets, 11 <strong>and</strong> so on. These are:dlmreadwk1readimreadRead ascii data file.Read spreadsheet (WK1) file.Read image from graphics file (JPEG, TIFF, etc.).11 For Lotus123 spreadsheets you can use the functions wk1read <strong>and</strong> wk1write. Ifyou use Micros<strong>of</strong>t Excel, the MathWorks’ Excel Link product allows direct communicationbetween Excel <strong>and</strong> matlab. For example, Excel can be used as a front-endfor matlab; you can call matlab functions or graphics routines directly from Excel,or you can access your Excel spreadsheet data directly from matlab.c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!