Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

Programming Fundamentals, MATLAB Version 7.8 (R2009a)

New features and changes introduced in this version are

Setting the Number of Threads Removed from Preferences Panel

The capability to adjust the number of computational threads in a single MATLAB session is no longer available as of this release. This change removes from the MATLAB preferences panel the ability to set the maximum number of computational threads. The primary reason for this change is that products that MATLAB is dependent upon have the ability to spawn threads from the currently-executing thread. This makes it infeasible to monitor and/or limit the number of computational threads at any given time in a MATLAB process.

MATLAB versions 7.8 and later require that you decide between threading and no threading at the time you launch your MATLAB session. Multithreading is enabled by default. To disable this feature, start MATLAB using the new singleCompThread option.

Compatibility Considerations

If you currently use the preferences panel to enable or disable multithreading or to adjust the number of computational threads, you need to be aware that this capability is no longer available. See the Startup Optionssection in the Desktop Tools and Development Environment documentation to find out how to enable or disable multithreading when launching a new MATLAB session.

Timer Objects Saved in New Format

The format in which MATLAB saves Timer objects has changed in MATLAB version 7.8. Any Timer objects that you create and save while running MATLAB 7.8 cannot be loaded into an earlier version of MATLAB.

Compatibility Considerations

If you need to use a Timer object that you have constructed using MATLAB 7.8, you will have to reconstruct and save the object in an earlier version of MATLAB.

mmreader Supports Linux Platforms

The mmreader object now supports Linux platforms. For more information about using mmreader, see the mmreader reference page.

Support of Microsoft Excel 2007 File Formats

If you have installed Excel® 2007 (or Excel 2003 with the Compatibility Pack) on your Windows system, the xlswrite function exports data to XLSX, XLSB, and XLSM formats.

To write data to an Excel file, specify the name and extension of the output file in the call to xlswrite. If the file already exists, xlswrite writes data in the existent file format. If the file does not exist, xlswrite creates a new file, using the format that corresponds to the file extension you specify. If you do not specify a file extension, xlswrite applies the XLS extension, and writes a new file in the XLS format.

The xlsread function imports any file format recognized by your version of Excel, including XLS, XLSX, XLSB, XLSM, and HTML-based formats. The importdata function imports XLS, XLSX, XLSB, and XLSM formats. The Import Wizard imports XLS and XLSX formats.

Anonymous Functions Support str2func

The str2func which, prior to this release, converted a function name to a function handle, now also converts an anonymous function definition to a function handle. See the function reference page for str2func for more information.

N = 5;   NthPower = str2func(['@(x)x.^', num2str(N)]);
NthPower(8)
ans =
     32768

size and range Implemented for validateattributes

The validateattributes function now enables you to check the size and range of the input value. The following commands validate the size and range of the values of x and y respectively:

x = rand(4,2,6);
y = uint8(50:10:200);

validateattributes(x, {'numeric'}, {'size', [4,2,6]});
validateattributes(y, {'uint8'}, {'>=', 50, '<=', 200})

isempty Supported for Map Objects

MATLAB now supports the isempty function for containers.Map objects. This example creates a 0-by-1 Map object and runs isempty on it:

mapObj = containers.Map;
size(mapObj)
ans =
     0     1

isempty(mapObj)
ans =
     1

Bug Fix for Misinterpreted Variables

The example below describes a bug in the MATLAB software that has been fixed in version 7.8. The bug was caused by misinterpretation of an unassigned variable. For certain names, MATLAB mistakenly interpreted the variable as a stem in dot indexing.

The following example illustrates the problem. The example is a bit artificial (which is why the bug went undiscovered for so long).

Suppose you have a function that is intended to perform two levels of dot-indexing:

function y = dotindextwice_A(j)
     y = j.lang.String;

Calling this function with no arguments results in an error in all versions of MATLAB, as it should.

Now modify the function slightly so that the input variable is named java and run it on a version of MATLAB prior to Version 7.8:

function y = dotindextwice_B(java)
y = java.lang.String;

Now when you run the function without arguments, MATLAB misinterprets the word java, treating it as if it were the stem of a Java class name:

x = dotindextwice_B;    % Deliberately called with no arguments

Prior to Version 7.8, this function did not throw an error. In fact, it returned an instance of the java.lang.String class:

class(x)
ans = 
    java.lang.String

This violates the rule that variables in functions are supposed to hide all other uses of the name. Beginning in Version 7.8, calling function dotindextwice_B without arguments results in an error, just as calling dotindextwice_A does.

MATLAB Upgrades Support for HDF5 to Version 1.8.1

The R2009a release of MATLAB uses version 1.8.1 of the HDF5 library. The HDF Group has deprecated two of the HDF5 library functions, H5Pget_cache and H5Pset_cache. Their M-file counterparts, H5P.get_config and H5P.set_config, may not work as they did in prior releases of MATLAB. To replace these deprecated functions in your code, consider these four new HDF5 functions: H5P.get_mdc_config, H5P.set_mdc_config, H5F.get_mdc_config, and H5F.set_mdc_config.

Compatibility Considerations

If your code uses H5P.get_cache or H5P.get_cache, your program will produce a warning message.

Indirect Calls to Superclass Constructors Now Errors

You can no longer call an indirect superclass constructor from a subclass constructor. For example, suppose class B is derived from class A, and class C is derived from class B. The constructor for class C should not call the constructor for class A to initialize properties. The call to initialize class A properties should be made from class B.

Compatibility Considerations

If you define classes in which subclass constructors call indirect superclass constructors, MATLAB now issues an error when you attempt to create an instance of the subclass. Call Only Direct Superclass from Constructor for information on how to correctly code subsclass constructors.

  


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