当前位置:首页 >> 工程科技 >>

有关matlab的数据格式教程


MATLAB? 7 MAT-File Format

How to Contact MathWorks

Web Newsgroup www.mathworks.com/contact_TS.html Technical Support
www.mathworks.com comp.soft-sys.matlab suggest@mathworks.com bugs@mathworks.com doc@mathworks.com service@mathworks.com info@mathworks.com

Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information

508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site. MAT-File Format ? COPYRIGHT 1999–2010 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government’s needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc.

Trademarks

MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
Patents

MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information.

Revision History

June 1999 November 2000 June 2001 July 2002 January 2003 June 2004 October 2004 September 2005 September 2007 March 2008 October 2008 March 2009 September 2009 March 2010 September 2010

Online only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only PDF only

New for MATLAB? 5.3 (Release 11) Revised for MATLAB? 6.0 (Release 12) Revised for MATLAB? 6.1 (Release 12.1) Revised for MATLAB? 6.5 (Release 13) Revised for MATLAB? 6.5.1 (Release 13 SP1) Revised for MATLAB? 7.0 (Release 14) Revised for MATLAB? 7.0.1 (Release 14SP1) Minor revision for MATLAB? 7.1 (Release 14SP3) Rereleased for Version 7.5 (Release 2007b) Revised for Version 7.6 (Release 2008a) Rereleased for Version 7.7 (Release 2008b) Rereleased for Version 7.8 (Release 2009a) Rereleased for Version 7.9 (Release 2009b) Rereleased for Version 7.10 (Release 2010a) Rereleased for Version 7.11 (Release 2010b)

1
MAT-File Format
Introduction (p. 1-2) Level 5 MAT-File Format (p. 1-4) Describes Level 5 and Level 4 MAT-files and how to access them. Describes the internal format of MAT-files that are compatible with MATLAB? Versions 5 and up. Shows how to use the Array data type to represent all types of MATLAB arrays. Describes the internal format of MAT-files that are compatible with MATLAB Versions 4 and earlier.

Level 5 MATLAB Array Data Element Formats (p. 1-13) Level 4 MAT-File Format (p. 1-36)

1

MAT-File Format

Introduction
This document describes the internal format of MATLAB Level 4 and Level 5 MAT-files. Level 4 MAT-files are compatible with versions of MATLAB up to Version 4. Level 5 MAT-files are compatible with MATLAB Versions 5 and up. You can read and write Level 4 MAT-files with the later versions of MATLAB, but when writing a MAT-file under these circumstances, you need to specify a switch in the save or matOpen command line to tell MATLAB that the MAT-file is at Level 4. A MAT-file stores data in binary (not human-readable) form. In MATLAB, you create MAT-files using the save function, which writes the arrays currently in memory to a file as a continuous byte stream. By convention, this file has the filename extension .mat; thus the name MAT-file. The load function reads the arrays from a MAT-file into the MATLAB workspace. Most MATLAB users do not need to know the internal format of a MAT-file. Even users who must read and write MAT-files from C and Fortran programs do not need to know the MAT-file format if they use the MAT-file interface. This interface shields users from dependence on the details of the MAT-file format. Note See "Importing and Exporting Data" in the MATLAB External Interfaces documentation for information on the MAT-file interface. See "C [or Fortran] MAT-File Functions" in the MATLAB External Interfaces Reference documentation for information on the functions available with this interface. However, if you need to read or write MAT-files on a system that does not support the MAT-file interface, you must write your own read and write routines. The MAT-file interface is only available for platforms on which MATLAB is supported. This document provides the details about the MAT-file format you will need to read and write MAT-files on these systems.

1-2

Introduction

Note Whenever possible, The MathWorks strongly advises you to use the MAT-file interface functions to read and write MAT-files. Any code you write that depends on the MAT-file format may need to be rewritten when the format changes in future releases.

MAT-File Formats
This document describes both Level 5 and Level 4 MAT-file formats. The Level 5 MAT-file format supports all the array types supported in MATLAB Versions 5 and up, including multidimensional numeric arrays, character arrays, sparse arrays, cell arrays, structures, and objects. “Level 5 MAT-File Format” on page 1-4 describes this format. The Level 4 MAT-file format is a simpler format, but it only supports two-dimensional matrices and character strings. “Level 4 MAT-File Format” on page 1-36 describes this format.

1-3

1

MAT-File Format

Level 5 MAT-File Format
Level 5 MAT-files are made up of a 128-byte header followed by one or more data elements. Each data element is composed of an 8-byte tag followed by the data in the element. The tag specifies the number of bytes in the data element and how these bytes should be interpreted; that is, should the bytes be read as 16-bit values, 32-bit values, floating-point values or some other data type. By using tags, the Level 5 MAT-file format provides quick access to individual data elements within a MAT-file. You can move through a MAT-file by finding a tag, and then skipping ahead the specified number of bytes until the next tag. MATLAB? Level 5 MAT-File Format on page 1-5 graphically illustrates this MAT-file format. The sections that follow provide more details about these MAT-file elements: ? “MAT-File Header Format” on page 1-6 ? “Data Element Format” on page 1-7 ? “Data Compression” on page 1-11

1-4

Level 5 MAT-File Format

Bytes
1 2 3 4 5 6 7 8

MAT-?le header (128 bytes)

Descriptive text (116 bytes)

subsys data offset subsys data offset data type version endian indicator

number of bytes Data (variable size) or subelements

Data element

data type

number of bytes Data (variable size) or subelements

Data element

Repeat tagged data elements until end-of-?le
Figure 1-1: MATLAB? Level 5 MAT-File Format

1-5

1

MAT-File Format

MAT-File Header Format
Level 5 MAT-files begin with a 128-byte header made up of a 124-byte text field and two, 16-bit flag fields. This section covers the following topics: ? “Header Text Field” on page 1-6 ? “Header Subsystem Data Offset Field” on page 1-7 ? “Header Flag Fields” on page 1-7

Header Text Field
The first 116 bytes of the header can contain text data in human-readable form. This text typically provides information that describes how the MAT-file was created. For example, MAT-files created by MATLAB include the following information in their headers: ? Level of the MAT-file (value equals 1 for Level 5) ? Platform on which the file was created ? Date and time the file was created You can view the text in a MAT-file header using the cat command on UNIX? systems, or the type command on a PC. The output displays the text in this part of the header. (The display of the header is followed by unreadable characters representing the binary data in the file.)
cat my_matfile.mat MATLAB 5.0 MAT-file, Platform: SOL2, Created on: Thu Nov 13 10:10:27 1997

Note When creating a MAT-file, you must write data in the first 4 bytes of this header. MATLAB uses these bytes to determine if a MAT-file uses a Level 5 format or a Level 4 format. If any of these bytes contains a zero, MATLAB will incorrectly assume the file is a Level 4 MAT-file.

1-6

Level 5 MAT-File Format

Header Subsystem Data Offset Field
Bytes 117 through 124 of the header contain an offset to subsystem-specific data in the MAT-file. All zeros or all spaces in this field indicate that there is no subsystem-specific data stored in the file.

Header Flag Fields
The last 4 bytes in the header are divided into two, 16-bit flag fields (int16). Field Version Endian Indicator Value When creating a MAT-file, set this field to 0x0100. Contains the two characters, M and I, written to the MAT-file in this order, as a 16-bit value. If, when read from the MAT-file as a 16-bit value, the characters appear in reversed order (IM rather than MI), it indicates that the program reading the MAT-file must perform byte-swapping to interpret the data in the MAT-file correctly.

Note Programs that create MAT-files always write data in their native machine format. Programs that read MAT-files are responsible for byte-swapping.

Data Element Format
Each data element begins with an 8-byte tag followed immediately by the data in the element. Figure 1-2 shows this format. (MATLAB also supports a compressed data element format. See “Small Data Element Format” on page 1-10 for more information.)

1-7

1

MAT-File Format

Bytes
1 2 data type 3 4 5 6 7 8 number of bytes

Tag Data

variable size

Figure 1-2:

MAT-File Data Element Format

This section covers the following topics: ? “The Tag Field” on page 1-8 ? “The Data Field” on page 1-10 ? “Small Data Element Format” on page 1-10 ? “Example Data Element” on page 1-11

The Tag Field
The 8-byte data element tag is composed of two, 32-bit fields: ? Data Type ? Number of Bytes Data Type. The Data Type field specifies how the data in the element should be interpreted, that is, its size and format. The MAT-file format supports many data types including signed and unsigned, 8-bit, 16-bit, 32-bit, and 64-bit data types, a special data type that represents MATLAB arrays, Unicode? encoded character data, and data stored in compressed format. The MAT-File Data Types on page 1-9 table lists all these data types with the values used to specify them. The table also includes symbols that are used to represent these data types in the examples in this document.

1-8

Level 5 MAT-File Format

Table 1-1 Value
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

MAT-File Data Types Symbol
miINT8 miUINT8 miINT16 miUINT16 miINT32 miUINT32 miSINGLE -miDOUBLE --miINT64 miUINT64 miMATRIX miCOMPRESSED miUTF8 miUTF16 miUTF32

MAT-File Data Type 8 bit, signed 8 bit, unsigned 16-bit, signed 16-bit, unsigned 32-bit, signed 32-bit, unsigned IEEE? 754 single format Reserved IEEE 754 double format Reserved Reserved 64-bit, signed 64-bit, unsigned MATLAB array Compressed Data Unicode UTF-8 Encoded Character Data Unicode UTF-16 Encoded Character Data Unicode UTF-32 Encoded Character Data

The UTF-16 and UTF-32 encodings are in the byte order specified by the Endian Indicator (See “Header Flag Fields” on page 1-7). UTF-8 is byte order neutral. For character data that is not Unicode encoded, the Data Type part of the Tag field should be set to miUINT16.

1-9

1

MAT-File Format

For more information about the miMATRIX data type, see “Level 5 MATLAB Array Data Element Formats” on page 1-13. Number of Bytes. The Number of Bytes field is a 32-bit value that specifies the number of bytes of data in the element. This value does not include the 8 bytes of the data element’s tag. If Data Type is miCOMPRESSED, then the Number of Bytes field contains the compressed MATLAB array size in bytes. (See “Data Compression” on page 1-11.)

The Data Field
The data immediately follows the tag. All data that is uncompressed must be aligned on 64-bit boundaries. When writing a MAT-file, if the amount of data in a data element falls short of a 64-bit boundary, you must add bytes of padding to make sure the tag of the next data element falls on a 64-bit boundary. Likewise, when reading data from a MAT-file, be sure to account for these padding bytes. Note For data elements representing MATLAB arrays, (type miMATRIX), the value of the Number of Bytes field includes padding bytes in the total. For all other MAT-file data types, the value of the Number of Bytes field does not include padding bytes.

Small Data Element Format
If a data element takes up only 1 to 4 bytes, MATLAB saves storage space by storing the data in an 8-byte format. In this format, the Data Type and Number of Bytes fields are stored as 16-bit values, freeing 4 bytes in the tag in which to store the data. Figure 4 illustrates this format.

Bytes
1 2 3 data type 4 5 6 data 7 8 number of bytes

Figure 1-3:

Small Data Element Format

1-10

Level 5 MAT-File Format

Note When reading a MAT-file, you can tell if you are processing a small data element by comparing the value of the first 2 bytes of the tag with the value zero (0). If these 2 bytes are not zero, the tag uses the small data element format. When writing to a MAT-file, use of the small data element format is optional.

Example Data Element
Figure 1-4 illustrates a data element representing an array of six 32-bit, unsigned integers: 1, 2, 3, 4, 5, 6. In the figure, the Data Type field contains the value from MAT-File Data Types on page 1-9 that specifies unsigned, 32-bit integers (miUINT32). The Number of Bytes field in the data element tag contains the number of data values multiplied by the number of bytes used to represent each value. Note that this value does not include the 8 bytes in the data element tag.
data type 1 2 miUINT32 1 3 5 3 4

Bytes
5

number of bytes 6 24 2 4 6 7 8

Tag Data

Figure 1-4:

Example MAT-File Data Element

Data Compression
MATLAB compresses the data it saves to a MAT-file using buffered in-memory gzip compression. It compresses MATLAB variables transparently as they are written out to disk. This technique uses less memory than systems that compress an entire variable at once before writing it out to disk. Also, no temporary files are required to read or write compressed data. Because it compresses each variable individually, MATLAB can read a compressed MAT-file like any other MAT-file. No code changes are required at either the C or M level to read a compressed MAT-file.

1-11

1

MAT-File Format

MATLAB compresses data for MAT-files (file I/O) only, not for sequential streams. The reason for this is that the size of the compressed variable is known only after it is compressed, but it must be written in the tag at the beginning of the variable. In a file it is possible to seek back and write the size, while in a stream this cannot be done. MAT-files containing compressed variables are nonplatform specific like any MAT-file, and such a file saved on any MATLAB supported platform can be loaded on any other supported platform. To decompress the contents of a compressed variable in a MAT-file, you can use the uncompress function from the freeware zlib-1.1.4 library available at the gzip web site, http://www.gzip.org/zlib/. Once a MATLAB array has been decompressed, you can ignore the miCOMPRESSED tag and process the data normally, as if it had not been compressed. Note To disable data compression when writing to MAT-files, see "Saving and Loading MAT-files" in the "Data Import and Export" chapter of the MATLAB Programming Fundamentals documentation.

Storing Compressed Data
MATLAB stores compressed data in gzip-compressed MATLAB arrays. Each compressed variable is stored complete with its tags and data field in the same format as uncompressed variables, as described in “Data Element Format” on page 1-7. The difference is that the entire variable is compressed into a data buffer, and this buffer is preceded by an 8-byte tag named miCOMPRESSED. The tag contains the length of the compressed buffer. Each variable in a MAT-file has a 56-byte header. Even if the data is stored in the header itself, as can be the case for variables containing 1 to 4 bytes of data, no variable in a MAT-file can be less than 56 bytes. Thus, regardless of how random the data in a variable may be, it is unlikely (but not impossible) that a compressed variable will take more space than its uncompressed counterpart. This is because the 56-byte header always compresses to a smaller size. Note that compression works best on nonrandom data. The more random the data, the less it will compress.

1-12

Level 5 MATLAB? Array Data Element Formats

Level 5 MATLAB Array Data Element Formats
The MAT-file data type miMATRIX (14) is used to represent all types of MATLAB arrays, including: ? Numeric arrays ? Character arrays ? Sparse arrays ? Cell arrays ? Structures ? Objects The miMATRIX data type is a compound data type. MAT-file data elements of this type are composed of multiple subelements. The subelements can be of any other MAT-file data type, including other miMATRIX data types. Figure 1-5 shows a miMATRIX data element composed of three subelements. Note how each subelement is a data element with its own tag. The value of the Number of Bytes field (96 in the figure) in the data element tag includes all the subelements.

1-13

1

MAT-File Format

Bytes
1 2 3 4 5 6 96 tag data tag 7 8 Tag miMATRIX

Subelement Subelement

data

Data element

96 bytes

tag

Subelement

data

Figure 1-5:

MATLAB? Array Data Element with Subelements

Each miMATRIX data element representing the different types of MATLAB arrays each has a specific set of subelements. Some of these subelements are common to all MATLAB arrays. Others subelements are unique to a particular type of array. The following sections detail the subelements for each MATLAB array type.

Numeric Array and Character Array Data Element Formats
A MAT-file data element representing a MATLAB numeric array or character array is composed of four subelements and one optional subelement. Table 1-2 lists the subelements in the order in which they appear in the data element. The table also includes the values of the Data Type and Number of Bytes fields you would use in the tag of each subelement. For an example, see “Examples of Numeric Array Data Elements” on page 1-19.

1-14

Level 5 MATLAB? Array Data Element Formats

Table 1-2

Numeric and Character Array Subelements with Tag Data Data Type
miUINT32 miINT32

Subelement Array Flags Dimensions Array

Number of Bytes
2 * sizeOfDataType (8 bytes) numberOfDimensions * sizeOfDataType

(To learn how to determine the number of dimensions, see “Dimensions Array Subelement” on page 1-17.)
miINT8 numberOfCharacters * sizeOfDataType numberOfValues * sizeOfDataType numberOfvalues * sizeOfDataType

Array Name Real part (pr) Imaginary part (pi) (Optional)

Any of the numeric data types. Any of the numeric data types.

Array Flags Subelement
This subelement identifies the MATLAB array type (class) represented by the data element and provides other information about the array. The Array Flags subelement is common to all array types. Figure 1-6 illustrates the format of the Array Flags subelement. (For sparse matrices, bytes 5 through 8 are used to store the maximum number of nonzero elements in the matrix. See “Sparse Array Data Element Format” on page 1-21 for more information.)

Bytes
1 unde?ned 2 3 ?ags 4 class 5 6 unde?ned 7 8

unde?ned 1 2 3 4

complex global 5 6

logical 7 8

Bits
Figure 1-6: Array Flags Format

1-15

1

MAT-File Format

Flags. This field contains three, single-bit flags that indicate whether the numeric data is complex, global, or logical. If the complex bit is set, the data element includes an imaginary part (pi). If the global bit is set, MATLAB loads the data element as a global variable in the base workspace. If the logical bit is set, it indicates the array is used for logical indexing. Class. This field contains a value that identifies the MATLAB array type (class) represented by the data element. Table 1-3 lists the MATLAB array types with the values you use to specify them. The table also includes symbols that are used to represent the MATLAB array type in the examples in this document. Note The value of the Class field identifies the MATLAB data type. The value of the Data Type field in the data element tag identifies the data type used to store the data in the MAT-file. The MAT-file data types are listed in Table 1-1. The value of the Class and the Data Type fields do not need to be the same; for more information, see “Automatic Compression of Numeric Data” on page 1-18.

Table 1-3

MATLAB Array Types (Classes) Value
1 2 3 4 5 6 7 8 9 10

MATLAB Array Type (Class) Cell array Structure Object Character array Sparse array Double precision array Single precision array 8-bit, signed integer 8-bit, unsigned integer 16-bit, signed integer

Symbol
mxCELL_CLASS mxSTRUCT_CLASS mxOBJECT_CLASS mxCHAR_CLASS mxSPARSE_CLASS mxDOUBLE_CLASS mxSINGLE_CLASS mxINT8_CLASS mxUINT8_CLASS mxINT16_CLASS

1-16

Level 5 MATLAB? Array Data Element Formats

Table 1-3

MATLAB Array Types (Classes) (Continued) Value
11 12 13

MATLAB Array Type (Class) 16-bit, unsigned integer 32-bit, signed integer 32-bit unsigned, integer

Symbol
mxUINT16_CLASS mxINT32_CLASS mxUINT32_CLASS

For numeric arrays, Class can contain any of the numeric array types: mxDOUBLE_CLASS, mxSINGLE_CLASS, mxINT8_CLASS, mxUINT8_CLASS, mxINT16_CLASS, mxUINT16_CLASS, mxINT32_CLASS, or mxUINT32_CLASS. For character arrays, Class contains mxCHAR_CLASS.

Dimensions Array Subelement
This subelement specifies the size of each dimension of an n-dimensional array in an n-sized array of 32-bit values (miINT32). All numeric arrays have at least two dimensions. The Dimensions Array subelement is common to all MATLAB array types. For example, if a data element represents a 2-by-3-by-2 MATLAB array, the Dimensions Array subelement would contain three values: 2, 3, and 2. Note To calculate the number of dimensions in an array, divide the value stored in the Number of Bytes field in the Dimensions Array subelement tag by 4, the number of bytes in the data type (miINT32) used in the subelement.

Array Name Subelement
This subelement specifies the name assigned to the array, as an array of signed, 8-bit values (miINT8). This subelement is common to all array types.

Real Part (pr) Subelement
This subelement contains the numeric data in the MATLAB array. If the array contains complex numbers (the complex bit in the Array Flags is set), this is the real part of the number.

1-17

1

MAT-File Format

The data type of the values can be any of the numeric data types listed in MAT-File Data Types on page 1-9. For character data that is not Unicode encoded, the Data Type part of the Tag field should be set to miUINT16.

Imaginary Part (pi) Subelement
This subelement contains the imaginary part of the numeric data in the MATLAB array. This subelement is only present if one or more of the numeric values in the MATLAB array is a complex number (if the complex bit is set in Array Flags). The data type of the values can be any of the numeric data types listed in MAT-File Data Types on page 1-9. Note When reading a MAT-file, check the value of the Data Type field in the tag of Real Part and Imaginary Part subelements to identify the data type used to store data. Also note that MATLAB reads and writes these values in column-major order.

Automatic Compression of Numeric Data
MATLAB stores the numeric data in an array in double-precision format. When MATLAB writes a numeric (or sparse) array to a MAT-file, ````it uses the smallest one of miINT32, miUINT16, miINT16, or miUINT8 to store the data, both the real and imaginary parts. For example, if MATLAB determines that the data stored in double-precision format can actually be stored in an 8-bit format, it will use an miUINT8 to store it in a MAT-file. Note, however, that if any of the numeric values in the array requires a 64-bit representation, MATLAB stores all of the data in a 64-bit data type. See “Compressed Data Element” on page 1-20 for an example. When you create a MAT-file, compressing data is optional.

1-18

Level 5 MATLAB? Array Data Element Formats

Note When MATLAB uses a smaller data type to store data in a MAT-file, the value of the Class field in the Array Flags subelement identifies the original MATLAB data type.

Examples of Numeric Array Data Elements
This section uses examples to illustrate both the compressed and uncompressed numeric array data element formats. Uncompressed Data Element. Figure 1-7 shows how this 2-by-2 numeric array, my_array, is represented in a MAT-file.
my_array = [ 1.1+1.1i 2 ; 3 4 ] my_array = 1.1000 + 1.1000i 3.0000 2.0000 4.0000

In the figure, note: ? The data element includes five subelements. Because one of the numeric values in the array is a complex number, the complex bit flag in the Array Flags subelement is set and the Imaginary Part (pi) subelement is included. ? The value of the Number of Bytes field in the data element tag includes all the subelements, but not the 8 bytes of the tag itself.

1-19

1

MAT-File Format

Bytes
1 2 3 4 5 6 128 8
mxDOUBLE _CLASS

7

8

Tag

miMATRIX miUINT32 unde?ned miINT32 2 miINT8 m y _ a r r

unde?ned 8 2 8 a 32 y

Array ?ags Dimensions array Array name

miDOUBLE

128 bytes

1.1000 3.0000 2.0000 4.0000 miDOUBLE 1.1000 0.0000 0.0000 0.0000 32

pr

pi

Figure 1-7:

Example Numeric Array MAT-File Data Element

Compressed Data Element. Figure 1-8 shows how the three-dimensional numeric array in this example, arr, is represented in a MAT-file when compression is used to conserve storage space.
A = [ 1 2 3 ; 4 5 6 ]; B = [ 7 8 9 ; 10 11 12]; arr = cat(3,A,B) arr(:,:,1) = 1 2 3

1-20

Level 5 MATLAB? Array Data Element Formats

4

5

6

arr(:,:,2) = 7 8 10 11

9 12

In the figure, note: ? The Array Name subelement uses the compressed data element format. ? The numeric data in the array, stored in double-precision format in MATLAB, is stored as 8-bit, unsigned values in the pr subelement. The Class field in the Array Flags subelement identifies the original MATLAB data type.

Bytes
1 2 3 4 5 6 72 8 0 miINT32
mxDOUBLE _CLASS

7

8

Tag

miMATRIX miUINT32 unde?ned

unde?ned 12 3 padding

Array ?ags

72 bytes

2 2 3 miUINT8 1 8 4 11 2 9 5 12 3 6 miINT8 A R

Dimensions array
R padding

Array name

12 7 padding 10

pr

Figure 1-8:

Example Numeric Array MAT-file Data Element (Compressed)

Sparse Array Data Element Format
A MAT-file data element representing a MATLAB sparse array is composed of six subelements and one optional subelement. Table 1-4 lists the subelements in the order in which they appear in the data element. The table lists the

1-21

1

MAT-File Format

values of the Data Type and Number of Bytes fields of the tag for each subelement. Table 1-4 Sparse Array Subelements with Tag Data Data Type
miUINT32 miINT32 miINT8 miINT32 miINT32

Subelement Array Flags Dimensions Array Array Name Row Index (ir) Column Index (jc)

Number of Bytes
2 * sizeOfDataType (8 bytes) numberOfDimensions * sizeOfDataType

where numberOfdimensions can be 0, 1 or 2.
numberOfcharacters * sizeOfDataType nzmax * sizeOfDataType

(The nzmax value is stored in Array Flags.)
(N+1) * sizeof(int32)

where N is the second element of the Dimensions array subelement. Any numeric data type Any numeric data type
numberOfNonzeroValues * sizeOfDataType numberOfNonzeroValues * sizeOfDataType

Real part (pr) Imaginary part (pi) (Optional)

Array Flags Subelement
This subelement identifies the MATLAB array type (class) represented by the data element and provides other information about the array. The Array Flags subelement is common to all array types. Figure 1-9 shows the Array Flags format. For sparse arrays, this value also contains the maximum number of nonzero elements in the array (nzmax).

Bytes
1 reserved 2 3 ?ags 4 class 5 6 nzmax 7 8

Maximum number of nonzero array elements
Figure 1-9: Array Flags Format for Sparse Arrays

1-22

Level 5 MATLAB? Array Data Element Formats

Flag. For more information, see “Flags” on page 1-16. Class. This field contains a value that identifies the MATLAB data type represented by the data element. For sparse arrays, Class contains the value 5 (mxSPARSE_CLASS). See “Class” on page 1-16 for more information.

Dimensions Array Subelement
This subelement specifies the size of each dimension of the array. This subelement is common to all array types. For more information, see “Dimensions Array Subelement” on page 1-17. Note that MATLAB only supports two-dimensional sparse arrays.

Array Name Subelement
This subelement specifies the name assigned to the array. This subelement is common to all array types. For more information, see “Array Name Subelement” on page 1-17.

Row Index for Nonzero Values (ir) Subelement
This subelement specifies the row indices of the nonzero elements in the real part (pr) of the matrix data and the imaginary part (pi) of the matrix data, if present. This subelement is a series of 32-bit (miINT32) values.

Column Index for Nonzero Values (jc) Subelement
This subelement contains column index information as a series of 32-bit (miINT32) values. For more information about what this subelement contains, see the MATLAB Application Program Interface Guide.

Real Part (pr) Subelement
This subelement contains the numeric data in the MATLAB array. If the array contains complex numbers (the complex bit in the Array Flags is set), this is the real part of the number. Because MATLAB uses data compression to save storage space, the data type of the values can be any of the numeric data types listed in MAT-File Data

1-23

1

MAT-File Format

Types on page 1-9. For more information, see “Automatic Compression of Numeric Data” on page 1-18.

Imaginary Part (pi) Subelement
This subelement contains the imaginary data in the array, if one or more of the numeric values in the MATLAB array is a complex number (if the complex bit is set in Array Flags). Because MATLAB uses data compression to save storage space, the data type of the values can be any of the numeric data types listed in MAT-File Data Types on page 1-9. For more information, see “Automatic Compression of Numeric Data” on page 1-18. Note You must check the value of the Data Type field in the tag of Real Part and Imaginary Part subelements to identify the type of the data. Also note that MATLAB reads and writes these values in column-major order.

Example Sparse Array
Figure 1-10 illustrates the MAT-file data element format of this 3-by-3 sparse matrix:
a = [ 1 2 3 ]; S = sparse(a,a,a+.5) S = (1,1) (2,2) (3,3) 1.5000 2.5000 3.5000

In the figure, note: ? The data element contains six subelements. ? The value of the Number of Bytes field in the data element tag includes all the subelements, but not the 8 bytes of the tag itself.

1-24

Level 5 MATLAB? Array Data Element Formats

? Bytes 5 through 8 of the Array Flags subelement contain the maximum number of nonzero elements (nzmax) in the sparse array. ? The Array Name subelement uses the compressed data element format.

Bytes
1 2 3 4 5 6 120 8 0 miINT32 3 1 miINT32 0 miINT8 S 12 1 padding 16 1 3 24 1.5000 2.5000 3.5000
mxSPARSE _CLASS

7

8

Tag

miMATRIX miUINT32 unde?ned

3 (nzmax) 8 3 padding

Array ?ags Dimensions array Array name

ir

120 bytes

2 miINT32 0 2 miDOUBLE

jc

pr

Figure 1-10:

Example Sparse Array MAT-file Data Element

Cell Array Data Element Format
A MAT-file data element representing a MATLAB cell array is composed of four subelements. Table 1-5 lists the subelements in the order in which they appear in the data element. The table lists the values of the Data Type and Number of Bytes fields of the tag for each subelement.

1-25

1

MAT-File Format

Table 1-5

Cell Array Subelements with Tag Data Data Type
miUINT32 miINT32 miINT8

Subelement Array Flags Dimensions Array Array Name Cells

Number of Bytes
2 * sizeOfDataType (8 bytes) numberOfDimensions * sizeOfDataType numberOfcharacters * sizeOfDataType

Each cell is written in place as an miMATRIX element.

Array Flags Subelement
This subelement identifies the MATLAB array type (class) represented by the data element and provides other information about the array. Figure 1-11 shows the Array Flags format. The Array Flags subelement is common to all array types.

Bytes
1 unde?ned 2 3 ?ags 4 class 5 6 unde?ned 7 8

Figure 1-11:

Array Flags Format

Flags. See “Flags” on page 1-16 for more information. Class. This field contains a value that identifies the MATLAB data type represented by the data element. For cell arrays, Class contains the value 1 (mxCELL_CLASS). For more information, see “Class” on page 1-16.

Dimensions Array Subelement
This subelement specifies the size of each dimension of the array. This subelement is common to all array types. For more information, see “Dimensions Array Subelement” on page 1-17.

Array Name Subelement
This subelement specifies the name assigned to the array. This subelement is common to all array types. For more information, see “Array Name Subelement” on page 1-17.

1-26

Level 5 MATLAB? Array Data Element Formats

Cells Subelement
This subelement contains the value stored in a cell. These values are MATLAB arrays, represented using the miMATRIX format specific to the array type: numeric array, sparse array, structure, object or other cell array. See the appropriate section in this document for details about the MAT-file representation of a each of these array types. Cells are written in column-major order.

Example Cell Array
Figure 1-12 illustrates the MAT-file data element format of this cell array:
A = [ 1 2 3 ; 4 5 6 ] A = 1 2 3 4 5 6 B = [ 7 8 9 ; 10 11 12 ] B = 7 8 9 10 11 12 C = { A, B } C = [2x3 double]

[2x3 double]

In the figure, note: ? The data element contains five subelements, the three common subelements; Array Flags, Dimensions and Array Name; and two cell subelements. ? The value of the Number of Bytes field in the data element tag includes all the subelements, but not the 8 bytes of the tag itself. ? Each cell subelement is an miMATRIX type. In the example, each cell contains a numeric array. For more information about the format of these elements, see “Numeric Array and Character Array Data Element Formats” on page 1-14.

1-27

1

MAT-File Format

Bytes
1 2 3 4 5 6 168 8 0 miINT32 1 1 miMATRIX miUINT32 unde?ned miINT32 0
mxDOUBLE _CLASS mxCELL _CLASS

7

8

Tag

miMATRIX miUINT32 unde?ned

unde?ned 8 2

Array ?ags Dimensions array

miINT8

C 56 8

padding

Array name

unde?ned Numeric array 8 3

168 bytes

2 1 miUINT8 1 4 2 5 3 6 miINT8 A

padding 6 padding 56 8

Cells

miMATRIX miUINT32 unde?ned miINT32 2 1 miUINT8 7 10 8 11 9 12 miINT8 8 0
mxDOUBLE _CLASS

unde?ned Numeric array 8 3 padding 6 padding

Figure 1-12:

Example Cell Array Data Element

1-28

Level 5 MATLAB? Array Data Element Formats

Structure MAT-File Data Element Format
A MAT-file data element representing a MATLAB structure is composed of six subelements. Table 1-6 lists the subelements in the order in which they appear in the data element. The table lists the values of the Data Type and Number of Bytes fields of the tag for each subelement. Table 1-6 Structure Subelements with Tag Data Data Type
miUINT32 miINT32 miINT8 miINT32 miINT8

Subelements Array Flags Dimensions Array Array Name Field Name Length Field Names Fields

Number of Bytes
2*sizeOfDataType (8 bytes) numberOfDimensions * sizeOfDataType numberOfCharacters * sizeOfDataType sizeOfDataType (4 bytes) numberOfFields * FieldNameLength

Each field is written in place as an array. Fields are written in column order.

Array Flags Subelement
This subelement identifies the MATLAB array type (class) represented by the data element and provides other information about the array. Figure 1-13 shows the Array Flags format. The Array Flags subelement is common to all array types.

Bytes
1 unde?ned 2 3 ?ags 4 class 5 6 unde?ned 7 8

Figure 1-13:

Array Flags Format

Flags. See “Flags” on page 1-16 for more information. Class. This field contains a value that identifies the MATLAB data type represented by the data element. For structures, Class contains the value 2 (mxSTRUCT_CLASS). For more information, see “Class” on page 1-16.

1-29

1

MAT-File Format

Dimensions Array Subelement
This subelements Specifies the size of each dimension of the array. This subelement is common to all array types. For more information, see “Dimensions Array Subelement” on page 1-17.

Array Name Subelement
This subelement specifies the name assigned to the structure. This subelement is common to all array types. For more information, see “Array Name Subelement” on page 1-17.

Field Name Length Subelement
This subelement specifies the maximum length of a Field Name. MATLAB sets this limit to 32 (31 characters and a NULL terminator). In a MAT-file created by MATLAB, this subelement always uses the compressed data element format.

Field Names Subelement
This subelement specifies the name of each field in the structure as a series of 8-bit (miINT8) character arrays. The value of the Field Name Length subelement determines the length of each field name array (32 bytes). Field names must be NULL-terminated.

Fields Subelement
This subelement contains the value stored in a field. These values are MATLAB arrays, represented using the miMATRIX format specific to the array type: numeric array, sparse array, cell, object or other structure. See the appropriate section of this document for details about the MAT-file format of each of these array type. MATLAB reads and writes these fields in column-major order.

Example
Figure 1-14 illustrates the MAT-file data element format for this MATLAB structure:
X.w = [1]; X.y = [2];

1-30

Level 5 MATLAB? Array Data Element Formats

X.z = [3]; X X = w: 1 y: 2 z: 3

In the figure, note: ? The data element contains eight subelements: the three common subelements (Array Flags, Dimensions and Array Name) and five structure-specific subelements (Field Name Length, Field Names, and three Field subelements). ? The value of the Number of Bytes field in the data element tag includes all the subelements, but not the 8 bytes of the tag itself. ? The Field Names subelement allocates 32 bytes of storage for each field name. A NULL terminator indicates the end of each field name. ? Each Field subelement is an miMATRIX data type. In the example, each field contains a numeric array. For more information about the format of these elements, see “Numeric Array and Character Array Data Element Formats” on page 1-14. ? Each of the numeric arrays contain zero-length Array Name subelements. The Field Names subelement contains the names of the numeric arrays.

1-31

1

MAT-File Format

Bytes
1 2 3 4 5 6 7 320 8 unde?ned 8 1 padding 32 96 8

Tag

miMATRIX miUINT32 mxSTRUCT 0 unde?ned _CLASS miINT32 2 1 miINT8 4 miINT32 miINT8 w 0

Array ?ags Dimensions array Array name Field name length

X

y

0 padding

Field names

z

0

320 bytes

miMATRIX miUINT32 mxDOUBLE unde?ned 0 _CLASS miINT32 1 miINT8 1 miUINT8 miMATRIX miUINT32 mxDOUBLE unde?ned 0 _CLASS miINT32 1 miINT8 1 miUINT8 miMATRIX miUINT32 mxDOUBLE unde?ned 0 _CLASS miINT32 1 miINT8 1 miUINT8

1

2

3

48 8 unde?ned 8 1 0 padding 48 8 unde?ned 8 1 0 padding 48 8 unde?ned 8 1 0 padding

Numeric array Numeric array

Cells
Numeric array

Figure 1-14:

Example Structure MAT-File Data Element

1-32

Level 5 MATLAB? Array Data Element Formats

MATLAB Object MAT-File Data Element Format
A MAT-file data element representing a MATLAB object is composed of seven subelements. Table 1-7 lists the subelements in the order in which they appear in the data element. An object data element has the same subelements as a structure with the addition of the Class Name subelement. The table lists the values of the Data Type and Number of Bytes fields of the tag for each subelement. Table 1-7 MATLAB Object Subelements with Tag Data Data Type
miUINT32 miINT32 miINT8 miINT8 miINT32 miINT8

Subelement Array Flags Dimensions Array Array Name Class Name Field Name Length Field Names Fields

Number of Bytes
2 * sizeOfDataType (8 bytes) numberOfDimensions * sizeOfDataType numberOfCharacters * sizeOfDataType numberOfCharacters * sizeOfDataType sizeOfDataType (4 bytes) numberOfFields * FieldNameLength

Each field is written in place as an array.

Array Flags Subelement
This subelement identifies the MATLAB array type (class) represented by the data element and provides other information about the array. Figure 1-15 shows the Array Flags format. The Array Flags subelement is common to all array types.

Bytes
1 reserved 2 3 ?ags 4 class 5 6 reserved 7 8

Figure 1-15:

Array Flags Format

Flags. See “Flags” on page 1-16 for more information.

1-33

1

MAT-File Format

Class. This field contains a value that identifies the MATLAB data type represented by the data element. For objects, the Class byte has the value 3 (mxOBJECT_CLASS). For more information, see “Class” on page 1-16.

Dimensions Array Subelement
This subelement specifies the size of each dimension of the array. This subelement is common to all array types. For more information, see “Dimensions Array Subelement” on page 1-17.

Array Name Subelement
This subelement specifies the name assigned to the array. This subelement is common to all array types. For more information, see “Array Name Subelement” on page 1-17.

Class Name Subelement
This subelement specifies the name assigned to the object class. This subelement is an array of 8-bit characters (miINT8).

Field Name Length Subelement
This subelement specifies the maximum length of a Field Name. See “Field Name Length Subelement” on page 1-30 for more information.

Field Names Subelement
This subelement specifies the name of each field in the structure. See “Field Names Subelement” on page 1-30 for more information.

Fields Subelement
This subelement contains the value stored in a field. See “Fields Subelement” on page 1-30 for more information.

Example
Figure 1-16 illustrates how the MATLAB object in this example is represented in a MAT-file.
X = inline(`t^2');

1-34

Level 5 MATLAB? Array Data Element Formats

The figure only shows the first four subelements of the object. For an example that shows the remaining subelements, see “Example” on page 1-30. In the figure, note: ? The Array Flag Class byte is set to mxOBJECT_CLASS. ? The data element includes the Class Name subelement.

Bytes
1 2 3 4 5 6 656 8 0 miINT32 1 1 miINT8 i n l i n e miINT8 X 6 padding
mxOBJECT _CLASS

7

8

miMATRIX miUINT32 unde?ned

unde?ned 8 1 padding

Array ?ags Dimensions array Array name Class name

The remaining elements are the same as for a structure

Figure 1-16:

Example Object MAT-file Data Element

1-35

1

MAT-File Format

Level 4 MAT-File Format
Note This section is taken from the MATLAB V4.2 External Interface Guide, which is no longer available in printed form. This section presents the internal structure of Level 4 MAT-files. This information is provided to enable users to read and write MAT-files on machines for which the MAT-file access routine library is not available. It is not needed when using the MAT-file subroutine library to read and write MAT-files, and we strongly advise that you do use the External Interface Library if it is available for all of the machines that you are working with. A MAT-file may contain one or more matrices. The matrices are written sequentially on disk, with the bytes forming a continuous stream. Each matrix starts with a fixed-length 20-byte header that contains information describing certain attributes of the Matrix. The 20-byte header consists of five long (4-byte) integers: Table 1-8 Field
type

Level 4 MAT-File Matrix Header Format Description The type flag contains an integer whose decimal digits encode storage information. If the integer is represented as MOPT where M is the thousands digit, O is the hundreds digit, P is the tens digit, and T is the ones digit, then:
M indicates the numeric format of binary numbers on the machine that wrote the

file. Use this table to determine the number to use for your machine:
0 1 2 3 4

IEEE Little Endian (PC, 386, 486, DEC Risc) IEEE Big Endian (Macintosh?, SPARC?, Apollo, SGI, HP 9000/300, other Motorola? systems) VAX D-float VAX G-float Cray

O is always 0 (zero) and is reserved for future use.

1-36

Level 4 MAT-File Format

Table 1-8 Field

Level 4 MAT-File Matrix Header Format (Continued) Description
P indicates which format the data is stored in according to the following table: 0 1 2 3 4 5

double-precision (64-bit) floating-point numbers single-precision (32-bit) floating-point numbers 32-bit signed integers 16-bit signed integers 16-bit unsigned integers 8-bit unsigned integers

The precision used by the save command depends on the size and type of each matrix. Matrices with any noninteger entries and matrices with 10,000 or fewer elements are saved in floating-point formats requiring 8 bytes per real element. Matrices with all integer entries and more than 10,000 elements are saved in the following formats, requiring fewer bytes per element. Element range [0:255] [0:65535] [-32767:32767] [-2^31+1:2^31-1] other Bytes per element 1 2 2 4 8 Numeric (Full) matrix Text matrix Sparse matrix

T indicates the matrix type according to the following table: 0 1 2

Note that the elements of a text matrix are stored as floating-point numbers between 0 and 255 representing ASCII-encoded characters.
mrows ncols

The row dimension contains an integer with the number of rows in the matrix. The column dimension contains an integer with the number of columns in the matrix.

1-37

1

MAT-File Format

Table 1-8 Field
imagf namlen

Level 4 MAT-File Matrix Header Format (Continued) Description The imaginary flag is an integer whose value is either 0 or 1. If 1, then the matrix has an imaginary part. If 0, there is only real data. The name length contains an integer with 1 plus the length of the matrix name. Immediately following the fixed length header is the data whose length is dependent on the variables in the fixed length header: Table 1-9 Field
name real

Level 4 MAT-File Matrix Data Format Description The matrix name consists of namlen ASCII bytes, the last one of which must be a null character ('\0'). Real part of the matrix consists of mrows * ncols numbers in the format specified by the P element of the type flag. The data is stored column-wise such that the second column follows the first column, etc. Imaginary part of the matrix, if any. If the imaginary flag imagf is nonzero, the imaginary part of a matrix is placed here. It is stored in the same manner as the real data.

imag

This structure is repeated for each matrix stored in the file. The following C language code demonstrates how to write a single matrix to disk in Level 1.0 MAT-file format.
#include <stdio.h> main() { typedef struct { long type; long mrows; long ncols; long imagf; long namelen;

1-38

Level 4 MAT-File Format

} Fmatrix; char *pname; double *pr; double *pi; Fmatrix x; int mn; FILE *fp; double real_data = 1.0; double imag_data = 2.0; fp = fopen("mymatfile.mat", "wb"); if (fp != NULL) { pname = "x"; x.type = 1000; x.mrows = 1; x.ncols = 1; x.imagf = 1; x.namelen = 2; pr = &real_data; pi = &imag_data; fwrite(&x, sizeof(Fmatrix), 1, fp); fwrite(pname, sizeof(char), x.namelen, fp); mn = x.mrows *x.ncols; fwrite(pr, sizeof(double), mn, fp); if(x.imagf) fwrite(pi, sizeof(double), mn, fp); } else printf("File could not be opened.\n"); fclose(fp); }

1-39

1

MAT-File Format

Again, we strongly advise against using this approach, and recommend that you instead use the MAT-file access routines provided in the External Interface Library. You will need to write your own C code as shown above only if you do not have the MAT-file access routines for the particular platform on which you need to read and write MAT-files.

1-40

Index
A
Index

array flags subelement 1-15 in sparse arrays 1-22 array name subelement 1-17

B
byte swapping 1-7

C
cell arrays example 1-27 MAT-file format 1-25 character arrays MAT-file format 1-14 classes MATLAB arrays 1-17 complex numbers in MAT-files 1-16 compressing data when saving data storage 1-12 decompressing variables 1-12 description 1-11 miCOMPRESSED data type 1-8 number of bytes 1-10 compression, data element description 1-10 compression, numeric description 1-18 example 1-21

format 1-7 MATLAB arrays 1-13 numeric array format 1-14 objects 1-33 padding bytes 1-10 sparse array format 1-21 structures 1-29 subelements 1-13 data types changed by compression 1-18 MAT-file vs. MATLAB 1-16 used in MAT-files 1-8 dimensions determining number of 1-17 dimensions array subelement 1-17

E
Endian indicator 1-7

F
field name length in structure data elements 1-30 field names in structure data elements 1-30 flags format 1-16

G
global variables in MAT-files 1-16

D
data elements alignment 1-10 cell arrays 1-25 character array format 1-14 compressed format 1-10 defined 1-4

H
header defined 1-4 flag fields 1-7 format 1-6 text field 1-6

Index-1

Index

I
IEEE 754 double format 1-9 imaginary data in data element 1-18

MAT-file format 1-33

P
padding bytes data elements 1-10 including in Number of Bytes total 1-10 pi 1-18 pr 1-17

L
logical arrays in MAT-files 1-16

M
MAT-files (V4) distinguishing from V5 format 1-6 format 1-36 MAT-files (V5) data types 1-8 distinguishing from V4 format 1-6 header format 1-6 header text field 1-6 numeric array data elements 1-14 overall format 1-4 version field 1-7 MATLAB array types 1-16 to 1-17 data element formats 1-13 miMATRIX 1-13 miMATRIX format 1-13

R
real data in data element 1-17

S
sparse arrays example 1-24 in MAT-file 1-21 structures example 1-30 MAT-file format 1-29 subelements defined 1-13

T
tags defined 1-4 format 1-8 number of bytes field 1-10

N
Number of Bytes field tag 1-10 numeric array compressed example 1-21 example 1-19 numeric arrays MAT-file format 1-14

U
Unicode character encoding 1-8

V
version field MAT-file V5 format 1-7

O
objects

Index-2


赞助商链接
相关文章:
table,matlab,中table数据类型,创建,调用,访问
table,matlab,中table数据类型,创建,调用,访问_数学_自然科学_专业资料。matlab中table数据类型的创建及调用 MATLAB table 数据结构目录: ? ? ? 关于作者 table ...
Matlab 2014软件教程(完美版)_图文
%查找有关积分的指令 lookfor fourier ??%查找能进行傅里叶变换的指令 1.3 ...网站地址:http://www.mathworks.com/ 3 2、Matlab 数据输入与类型 2.1 ...
MATLAB数值数据
MATLAB数值数据_计算机软件及应用_IT/计算机_专业资料。有关MATLAB数值数据的一些相关知识要点 1.2 MATLAB 数值数据 1、 数值数据类型的分类 整型 浮点型 附属型...
[MATLAB数据归一化汇总(最全面的教程)
[MATLAB数据归一化汇总(最全面的教程)_计算机软件及应用_IT/计算机_专业资料。[...关于用 premnmx 语句进行归一化: premnmx 语句的语法格式是:[Pn,minp,maxp,Tn...
如何控制matlab中的数据输出格式
如何控制matlab中的数据输出格式 - 如何控制 matlab 中的数据输出格式? 2009/04/02 22:33 [useful ] 如何控制 matlab 中的数据输出格式? 针对数据的...
MATLAB保存数据方法
MATLAB保存数据方法_计算机软件及应用_IT/计算机_专业资料。介绍MATLAB保存数据的相关函数,有例子说明。 如果你想保存为.mat 的格式,就是用 save 函数 如果想保存...
实验2 MATLAB数据类型的认识与使用
实验2 MATLAB数据类型的认识与使用_计算机软件及应用_IT/计算机_专业资料。实验 2 MATLAB 数据类型的认识与使用一、实验任务 1. 关于整型数据的练习 (1)设整数 ...
MATLAB文件操作详解
MATLAB文件操作详解_信息与通信_工程科技_专业资料。MATLAB 对文件的读取写入具体操作 matlab 文件操作文件操作是一种重要的输入输出方式, 即从数据文件读取数据或将...
matlab中将数据保存为txt或dat格式四种方案
有关matlab的数据格式教... 46页 免费 喜欢此文档的还喜欢 将matlab中数据保存...MATLAB教程(1-7章) 79页 免费 MATLAB自学实用基础教程 61页 1下载券 mat...
matlab中的数据导入和导出
Matlab 文件数据的导入与导出 Matlab 文件数据的导入与导出 在编写一个程序时,经常需要从外部读入数据,或者将程序运行的结果保存为文 件MATLAB 使用多种格式...
更多相关标签: