23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6 Data Import and Export<br />

41 42 43 44 45 46 47 48<br />

51 52 53 54 55 56 57 58<br />

61 62 63 64 65 66 67 68<br />

71 72 73 74 75 76 77 78<br />

wk1write('matA.wk1', A);<br />

Importing from the File<br />

To import data from the spreadsheet into the <strong>MATLAB</strong> workspace, use<br />

wk1read. There are three ways to call wk1read. The first two shown here are<br />

similar to wk1write. The third enables you to select a range of values from<br />

the spreadsheet. You can specify the range argument with a one-based vector,<br />

spreadsheet notation (e.g., 'A1..B7'), or using a named range (e.g., 'Sales').<br />

Inputs to wk1read are<br />

• Name of the spreadsheet file<br />

• Spreadsheet location from which to read the data<br />

• Range of cells from which to read the data<br />

Outputs from wk1read are<br />

• Requested data from the spreadsheet<br />

Example — Reading from a WK1 File. Read in a limited block of the<br />

spreadsheet data by specifying the upper-left row and column of the block<br />

using zero-based indexing:<br />

M = wk1read('matA.wk1', 3, 2)<br />

M =<br />

33 34 35 36 37 38<br />

43 44 45 46 47 48<br />

53 54 55 56 57 58<br />

63 64 65 66 67 68<br />

73 74 75 76 77 78<br />

6-102

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

Saved successfully!

Ooh no, something went wrong!