Graphics Programs Reference
In-Depth Information
q=
7 8 9
6 1 2
5 4 3
>> save saved_data_text -ascii
>> clear
>> load saved_data_text
>> whos
Name
Size
Bytes Class
saved_data_text
3x3
72 double array
Grand total is 9 elements using 72 bytes
>> saved_data_text
saved_data_text =
7
8
9
6
1
2
5
4
3
The 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 Formats
You may be presented with some data written by another piece of soft-
ware that you want to load into matlab. In this case you have the
following options:
1. You can write a translation program in another language (C or
fortran for example) that reads in the data and then writes it to
another file that can be read into matlab—that is, a mat-file.
2. You can write a matlab-callable program (mex-file) that reads
in the data and returns appropriate variables in the matlab
workspace. This is a good option if you already have code to read
in the data.
3. You can use one of the functions for reading in standard file formats
for images, sounds, spreadsheets, 11 and so on. These are:
dlmread Read ascii data file.
wk1read Read spreadsheet (WK1) file.
imread
Read image from graphics file (JPEG, TIFF, etc.).
11 For Lotus123 spreadsheets you can use the functions wk1read and wk1write .If
you use Microsoft Excel, the MathWorks' Excel Link product allows direct commu-
nication between Excel and matlab. For example, Excel can be used as a front-end
for matlab; you can call matlab functions or graphics routines directly from Excel,
or you can access your Excel spreadsheet data directly from matlab.
Search WWH ::




Custom Search