Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

Programming, MATLAB Version 7.3 (R2006b)

New features and changes introduced in this version are:

Saving to MAT-Files Larger than 2 GB

With MATLAB R2006b, you can save data items that are over 2 gigabytes in size. This capability is implemented in MATLAB using a new HDF5-based format for MAT-files.

To save to a MAT-file in this format, specify the new -v7.3 option with the save function:

save -v7.3 myfile v1 v2

In this release,

In a future release,

Here is a summary of the version options that you can use with save:

save OptionDescriptionAvailable In VersionsIs the Default In Versions
save -v4Save to a MAT-file you can open in MATLAB version 4V5 and laterV4, V5
save -v6Save to a MAT-file you can open in MATLAB versions 5 or 6V7 and laterV6
save -v7Save to a MAT-file you can open in MATLAB version 7 V7.3 and laterV7.3
save -v7.3Save to a MAT-file that supports data items ≥2 GBV7.3 and laterpost V7.3

Compatibility Considerations

If you are running MATLAB on a 64-bit computer system and you attempt to save a variable that is too large for a version 7 (or earlier) MAT-file, that is, you save without using the -v7.3 option, MATLAB skips that variable during the save operation and issues a warning message to that effect.

If you are running MATLAB on a 32-bit computer system and attempt to load a variable from a -v7.3 MAT-file that is too large to fit in 32–bit address space, MATLAB skips that variable and issues a warning message to that effect.

Import Wizard Generates Import M-Code

The Import Wizard now includes an automated M-code generation option. Click the Generate M-code button located in the lower right of the Import Wizard window and MATLAB generates an M-file that you can use to import additional files that are similar in type to the file you are currently importing. This simplifies the process of importing multiple files into MATLAB.

New Dynamic Regular Expression Syntax

The new (?@cmd) operator specifies a MATLAB command that regexp or regexp is to run while parsing the overall match expression. Unlike the other dynamic expressions in MATLAB, this operator does not alter the contents of the expression it is used in. Instead, you can use this functionality to get MATLAB to report just what steps it's taking as it parses the contents of one of your regular expressions. This can be helpful in debugging regular expressions, for example.

New Reserved MATLAB Keywords

Two new reserved keywords have been added to the MATLAB language in this release:

The iskeyword function returns true for each of these functions, thus identifying them as reserved keywords in MATLAB:

Compatibility Considerations

MATLAB keywords are reserved for use internal to MATLAB, and should not be used in your own program code as identifiers or function names. If your code uses either of these two new keywords in this manner, you should modify your code and use words that are not reserved.

Enhancements to Display Generated by whos

The visual output of the information returned by whos looks slightly different in R2006b than in previous releases. Changes are as follows:

Here is an example of the information displayed by whos in MATLAB 7.3:

whos
  Name            Size             Bytes  Class              Attributes

  vCell           5x7               2380  cell                         
  vComplex        6x2                192  double             complex   
  vDouble         6x5x9             2160  double                       
  vFuncHdl        1x1                 16  function_handle              
  vGlobal         0x0                  0  double             global    
  vObject         1x1                248  timer                        
  vPersist        0x0                  0  double             persistent
  vSparse        15x15               244  double             sparse    
  vStruct         1x3                804  struct                       

Compatibility Considerations

If any of your programs depend on the displayed output of whos, specifically in relation to the changes listed above, you might have to modify your program code. Also, if your code relies on a specific number of fields for the output structure, you should be aware that this release adds a new field: persistent.

unique Function Returns First and Last Indices

Using the new first option with the unique function returns a vector with elements that represent the lowest indices of unique elements in the input vector.

Given the following vector A

A = [16 7 5 41 2 16 8 2 6 3 16 6 2 5 2 5];

Get a sorted vector of the unique elements of A:

v = unique(A)
v =
     2     3     5     6     7     8    16    41

Use the first and last options to get indices of the first and last elements in A that make up the sorted vector v:

[v, m1] = unique(A, 'first');
m1
m1 =
     5    10     3     9     2     7     1     4

[v, m2] = unique(A, 'last');
m2
m2 =
    15    10    16    12     2     7    11     4

save Compression and Unicode Options Removed

In MATLAB Versions 7.0 through 7.2, you could use the switches –compress, –nocompress, –unicode, and –nounicode with the save function to enable or disable compression and Unicode character encoding in the MAT-file being generated. In MATLAB Version 7.3, the save function no longer supports these switches. Instead, save now creates a MAT-file with compression and Unicode character encoding by default, or with the following command:

save -v7 filename

You can still save to a MAT-file without using compression or Unicode encoding. In fact, you will have to do this in order to create MAT-files that you can load into a MATLAB Version 6 or earlier. To save to a MAT-file without compression or Unicode encoding, type

save -v6 filename

To disable compression and Unicode encoding for all save operations in a MATLAB session, open the MATLAB Preferences dialog, select General and then MAT-Files, and then click the button labelled Ensure backward compatibility (-v6).

Compatibility Considerations

If you have code that uses any of these option switches with the save function, you will need to modify that code to use the –v6 option instead.

Warning Generated by try-catch

To accommodate future changes in the MATLAB error handling capabilities, MathWorks has added a new restriction to the single-line syntax of the try-catch block. In this release, the following syntax operates as it did in previous releases, but now it also generates the following warning message:

try try_statements, catch catch_statements, end

Warning: This try-catch syntax will continue to work in R2006b, 
but may be illegal or may mean something different in future 
releases of MATLAB.

To make this single-line try-catch work without warning in R2006b, you must insert a separator character (comma, semicolon, or newline) immediately after the word catch

try try_statements, catch, catch_statements, end

As with previous releases, the recommended syntax for a try-catch block is as follows:

try
   try_statements
catch
   catch_statements
end

Compatibility Considerations

Your M-file programs may generate this warning if correct syntax for try and catch is not used.

Case-Sensitivity Warning Removed

The following warning has been removed from MATLAB in release R2006b:

"Function call foo invokes /somewhere/on/the/path/foo.m,
however, function /somewhere/ahead/on/the/path/FOO.m that
differs only in case precedes it on the path."

In previous versions of MATLAB, this warning message was triggered when you called a function such as foo, and all of the following were true:

Earlier versions of MATLAB displayed this warning for the purpose of helping users cope with newly-introduced case sensitive dispatching changes. The warning is being removed at this time under the assumption that users are now sufficiently well-acquainted with the way MATLAB handles case sensitivity in function calls.

Compatibility Considerations

The dispatching behavior regarding to the case sensitivity is NOT changed with the removal of this warning message. If both an exact match and inexact match are present on the path, the exact match is always the one to be invoked.

fprintf(0,...) Now Throws an Error

Commands such as fprintf(0, ...) and fwrite(0, ...), in which the file identifier is zero (the same as stdin) now result in an error being thrown. In previous releases, MATLAB did not throw an error in response to these commands, even though printing or writing to stdin is clearly not a valid option.

Compatibility Considerations

If any of your programs use lower-level MATLAB file I/O functions that send output to stdin, because these functions no longer ignore this type of operation, your code will now generate an error. You should modify your program code to use a file identifier other than zero.

Assigning Nonscalar Structure Array Fields to a Single Variable

In the R14 and R14 service pack releases of MATLAB, assigning a nonscalar structure array field to a single variable incorrectly resulted in an error. For example, in the following code, you should be able to assign S.A to one, two, three, or four output variables. However, if you assign to just a single variable, MATLAB throws an error:

% Create a 1-by-4 structure array S with field A.
S(1).A = 1;   S(2).A = 2;   S(3).A = 3;   S(4).A = 4;

% Assigning S(1).A and S(2).A works as expected.
[x y] = S.A
x =
     1
y =
     2

% Assigning only S(1).A should work, but does not.
x = S.A;
??? Illegal right hand side in assignment. Too many elements.

This has been fixed in MATLAB 7.3.

Compatibility Considerations

If any of your programs rely on this error being thrown, you will need to modify those programs.

Comma Separators Not Required in Function Declaration

As of Release 14, the function definition line in a function M-file no longer requires commas separating output variables. This now makes the function definition syntax the same as the syntax used when calling an M-file function:

function [A B C] = myfun(x, y)

Compatibility Considerations

This new syntax is not valid in MATLAB versions earlier than Release 14. When writing an M-file that you expect to run on versions both earlier and later than R14, be sure to separate any output variables in the function definition line with commas:

function [A, B, C] = myfun(x, y)

Improved Performance on Certain Platforms and Operations

In this release, MATLAB offers improved performance in the following areas:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS