Programming, MATLAB Version 7.5 (R2007b)

New features and changes introduced in this version are

Increased Size for Large Arrays

On 64-bit platforms, MATLAB arrays are no longer limited to 231 elements. The limit in MATLAB 7.5 is 248-1. For example, given sufficient memory, many numeric and low-level file I/O functions now support real double arrays greater than 16 GB.

Documentation for Multiprocessing in MATLAB

Documentation for "Multiprocessing in MATLAB" has moved from Desktop Tools and Development Environment to the "Improving Performance and Memory Usage" section of MATLAB Programming.

Setting Number of Threads Programmatically

In this release, MATLAB provides a way to set or retrieve the maximum number of computational threads from within an M-file program. With the maxNumCompThreads function, you can either set the maximum number of computational threads to a specific number, or indicate that you want the setting to be done automatically by MATLAB

New Internal Format for P-code

P-code files have a new internal format in MATLAB Version 7.5. The new P-code files are smaller and more secure than those built with MATLAB 7.4 and earlier, and provide a more robust solution to protect your intellectual property.

Any P-code files that were built using MATLAB 7.4 or earlier also work in 7.5. However, support for these older files will at some point be removed from MATLAB.

P-code files built with MATLAB 7.5 only work on 7.5 or later. They cannot be used with MATLAB 7.4 or earlier versions.

Compatibility Considerations

Rebuild any P-code files using MATLAB 7.5 that you expect to need in the future.

New Split String Functionality in regexp

Using the regular expressions function regexp, you can now split an input string into sections by specifying the new 'split' option when calling regexp:

s1 = ['Use REGEXP to split ^this string into ' ...
      'several ^individual pieces'];

s2 = regexp(s1, '\^', 'split');

s2(:)
ans = 
    'Use REGEXP to split '
    'this string into several '
    'individual pieces'

The split option returns those parts of the input string that are delimited by those substrings returned when using the regexp 'match' option.

Changes Related to Error Handling

New Error Handling Mechanism

MATLAB extends its error-handling capabilities with the new MException class to provide you with a more secure and extensible system for throwing and responding to errors. Read about this new feature in the Error Handling section of the MATLAB Programming documentation and in related function reference pages such as MException.

This feature extends the error-handling capabilities available in earlier releases, but does not replace that functionality. Your M-file programs will continue to function the same when using Version 7.5.

New Syntax for catch Function

As part of new error-handling mechanism, the catch function has a new, optional syntax:

catch ME

ME is an object of the MException class. This command gives you access to the MException object that represents the error being caught.

Warning and Error Messages Now Wrap

In previous versions of MATLAB, warning and error messages that were longer than the width of your terminal screen extended beyond the visible portion of your screen. These messages now wrap onto succeeding lines so that the entire text of the warning or error is visible.

Change to Error Message from Anonymous Function

The error message and M-file line number that MATLAB displays when encountering an error in an anonymous function defined within a script file or at the MATLAB Command Line has changed in this release. In MATLAB Version 7.4, the error message included the line number (set to 1 for anonymous functions), and the stack information returned by the lasterror function also showed the line number as 1. In MATLAB 7.5, the line number is not displayed in the error message and is set to 0 in the returned stack information.

For example, when you enter the following two lines at the command line, MATLAB generates an error from the anonymous function:

X = @() error('* Error *');
X()

This example shows the difference between MATLAB Versions 7.4 and 7.5:

e = lasterror;

e.message
ans =
Error using ==> @()error('Error') at 1    % V7.4 response
Error using ==> @()error('Error')         % V7.5 response
* Error *

e.stack
ans = 
    file: ''
    name: '@()error('* Error *')'
    line: 1                               % V7.4 response
    line: 0                               % V7.5 response

Compatibility Considerations.   If you have programs that rely on the line number returned in response to an error in an anonymous function, these programs may not work as expected. Remove dependencies on the returned error message and line number, or update your program code to use the new string and value.

New Message In Response to Ctrl+C

MATLAB now displays a more user-friendly message when you press Ctrl+C. The previous response to Ctrl+C was

Error in ==> testctrlc>waitawhile at 5
pause(100);

Error in ==> testctrlc at 2
waitawhile

In this and future releases, pressing Ctrl+C still halts program execution, but now displays the response

??? Operation terminated by user during ==> testctrlc>
   waitawhile at 5

In ==> testctrlc at 2
waitawhile

Compatibility Considerations.   You only need to be aware that the change in the text of this message is intentional and does not signify any error on your part.

hdfread Errors Instead of Warns on I/O Failures

In previous releases, hdfread issued a warning when a requested I/O operation failed. In addition, hdfread created an empty variable in the workspace. In this release, hdfread now errors when a requested I/O operation fails and does not create an empty variable in the workspace.

Compatibility Considerations.   If you call hdfread in a script to perform an I/O operation and that operation fails, your script will now terminate. Previously, because hdfread only warned when an I/O operation failed, your script would continue processing.

Results From tempname Are More Unique

The tempname function now produces a string such as

C:\Temp\tpe51f2ba3_9ad3_490f_8142_58359c98f4a5

when Java is present, or a string like

C:\Temp\tp346976948758473

when nojvm is selected. Underscores are included in the name so you can use the filename portion of it as a valid M-function name. If a string row vector is passed in as an argument, that string is used instead of tempdir as the root.

Compatibility Considerations

Because the new string generated by tempname is generally longer than the string constructed in earlier versions, there is a possibility of exceeding length restrictions, especially if your program code passes a string to the tempname function. If you consider this to be a potential problem, verify that the strings you pass to tempname will not result in an overly long string being returned.

MATLAB Includes New Input Argument Validation Functions

MATLAB now includes two new functions that validate the input arguments passed to functions. For example, you can use these functions to make sure that an input argument is numeric and nonempty. The following table lists these functions with a brief description.

FunctionDescription
validateattributesCheck validity of array
validatestringCheck validity of text string

Windows Current Working Directory Corrected

On Windows, you can define a current working directory, cwd, for each drive letter. For example, entering the command cd D:\work at the DOS prompt defines your D current working directory as D:\work. All references to D: are then relative to this directory.

The term . . .Represents the directory . . .
D:D:\work
D:matlabD:\work\matlab
D:\matlabD:\matlab

(Note the difference between D:\ and D:, where the former is the drive D, and the latter is a user-defined working directory that may or may not be equal to D:\.)

Previous versions of MATLAB have been inconsistent in the way that volume-relative path specification is handled. For example, in MATLAB 7.4 and earlier, if D: were defined as the directory D:\work, the following commands on the left and right returned identical results:

dir D:                             dir D:\
dir D:matlab                       dir D:\work\matlab
fileparts('D:myfile.m')            fileparts('D:\myfile.m')

This has been fixed in MATLAB 7.5 so that the following are now equivalent:

dir D:                             dir D:\work
dir D:matlab                       dir D:\work\matlab
fileparts('D:myfile.m')            fileparts('D:\work\myfile.m')

Compatibility Considerations

Some MATLAB commands may fail or return unexpected results if you use Windows current working directories on MATLAB. You might have to update hard-coded paths if you have been relying on the incorrect behavior exhibited in earlier versions.

New Multimedia Functionality

A new mmreader video file reader object for Windows platforms supports formats such as AVI, MPEG, and WMV, and adds the ability to read additional video codecs that aviread does not support. For more information, see the mmreader and read reference pages.

Compressed AVI Video Files in Windows Vista and Windows XP x64

Because Windows Vista, Windows Vista 64-bit, and Windows XP x64 operating systems do not ship with the Indeo5 codec, which is the default codec used by MATLAB Audio-Video functions for file compression, the functions movie2avi and avifile now generate uncompressed AVI files on these platforms. Also, aviread on these platforms cannot read files that were compressed using the Indeo5 codec.

Compatibility Considerations

If you have upgraded your Windows operating system to Windows Vista, Windows Vista 64-bit, or Windows XP x64, you need to install the Indeo5 codec to read or create Indeo5 compressed AVI files with aviread, avifile, or movie2avi. You can learn more about downloading the Indeo5 codec from the Ligos Corporation Web site at http://ligos.com/index.php/home/products/indeo/

mmfileinfo Reads Files on MATLAB Path

The mmfileinfo function now reads files on the MATLAB path, not only those in the current directory. The mmfileinfo output struct contains a field called Path, which indicates the directory where the file exists.

Compatibility Considerations

The Filename field of the output struct from mmfileinfo now contains only the filename itself without any path information, while the path information is contained in the Path field. In previous releases, the Filename field contained both path and filename information.

Changes to imread Support of TIFF Format

The imread function includes several updates to its TIFF support:

Removal of freeserial Function

The freeserial function is now obsolete. Use fclose to release the serial port.

Compatibility Considerations

If your program code still makes use of the freeserial function, replace each instance with the fclose function instead.

  


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