| Contents | Index |
This version introduces the following new features and changes:
regexprep Now Supports Character Representations in Replacement String
Logical OR Operator | in regexp Expressions Might Yield Different Results from Previous Version
Multiple Declarations of Persistent Variables No Longer Supported
Unicode is becoming the preferred internal presentation of characters in MATLAB. For example, MATLAB functions such as disp require an input string in Unicode to display properly. To facilitate the use of different character sets, MATLAB provides two new functions to convert characters from a native character set to Unicode and back.
The native2unicode function converts from either a default, or user specified, native character set to Unicode. The unicode2native function does the opposite, converting from Unicode to either a default, or user specified, native character set. Note that any MATLAB string containing only US-ASCII characters does not require any conversion.
Type doc native2unicode or doc unicode2native for more information on these functions.
For the purpose of backwards compatibility, invoking the command datevec('') now returns an empty vector.
This behavior was not intentional in previous versions of MATLAB, and it is subject to change in future releases.
The depfun function now supports these options:
Option | Description |
|---|---|
'-all' | Computes all possible left-side arguments and displays the results in the report(s). Only the specified arguments are returned. |
'-calltree' | Returns a call list in place of a called_from list. This is derived from the called_from list as an extra step. |
'-expand' | Includes both indices and full paths in the call or called_from list. |
'-print', 'file' | Prints a full report to file. |
'-quiet' | Displays only error and warning messages, and not a summary report. |
'-toponly' | Examines only the files listed explicitly as input arguments. It does not examine the files on which they depend. |
'-verbose' | Outputs additional internal messages. |
The ftell function is likely to return an invalid position when all of the following are true. This is due to the way in which the Microsoft Windows C library currently handles its ftell and fgeptos commands:
The file you are currently operating on is an ASCII text file.
The file was written on a UNIX-based system, or uses the UNIX-style line terminator: a line feed (with no carriage return) at the end of each line of text. (This is the default output format for MATLAB functions dlmwrite and csvwrite.)
You are reading the file on a Windows system.
You opened the file with the fopen function with mode set to 'rt'.
The ftell command is directly preceded by an fgets command.
Note that this does not affect the ability to accurately read from and write to this type of file from MATLAB.
This represents a change in behavior.
The fwrite function can now save uint64 and int64 values. Previously fwrite supported these data types only on DEC Alpha systems. Now, it works on all supported MATLAB platforms.
In MATLAB 7.0.1, you can use the mat2str function to convert nondouble data types to a string that represents the input value. Type doc mat2str for more information.
The nargin and nargout functions now accept a either a function name or function handle as an input argument. When called with a function handle, nargin and nargout return the number of input or output arguments you can pass to or receive from the function that the handle maps to.
The regexprep function now supports the use of character representations (e.g., '\t' for tab, '\n' for newline) in replacement strings. For example, the following regexprep command replaces the | character with two horizontal tabs:
str = 'Field 1 | Field 2 | Field 3'; regexprep(str, '\|', '\t\t') ans = Field 1 Field 2 Field 3
In Version 6, the same command yielded the string
Field 1 \t\t Field 2 \t\t Field 3
Be careful about using the logical OR (|) operator within square brackets (e.g., [A|B]) in regular expressions in MATLAB. The recommended way to match "the letter A or the letter B" in a MATLAB regexp expression is to use '[AB]'.
If you have used '[A|B]' for this purpose in earlier versions of MATLAB, you may get unexpected results when you run your code in version 7.0.
MATLAB versions 6.0 and 6.5 treat | as an ordinary character when it is used between square brackets. For example, these versions interpret the expression '[A|B]' as "match 'A', or match '|', or match 'B'." MATLAB 7.0 correctly gives precedence to the logical OR functionality of the | operator. Because of this change, MATLAB now interprets '[A|B]' as "match '[A', or match 'B]'."
You can avoid the effects of this bug fix altogether by using the recommended syntax '[AB]' for this type of operation. This syntax returns the correct results in all MATLAB versions.
The following example attempts to find the word Jill or Bill in the string 'My name is Bill'. The syntax used in the expression is incorrect, but regexp in MATLAB 6.5 finds a match anyway because of the software bug. This syntax does not work in version 7.0 or 7.0.1 because MATLAB now interprets the expression as the logical OR of the two statements, '[J' and 'B]ill':
- MATLAB 6.5 - - MATLAB 7.0.1 - str = 'My name is Bill'; str = 'My name is Bill'; expr = '[J|B]ill'; expr = '[J|B]ill'; [s e] = regexp(str, expr); [s e] = regexp(str, expr); str(s:e) str(s:e) ans = ans = Bill Empty string: 1-by-0
Using the recommended syntax returns the correct results in all MATLAB versions:
str = 'My name is Bill'; expr = '[JB]ill'; [s e] = regexp(str, expr); str(s:e) ans = Bill
If you want to use | in an expression as an ordinary character, precede it with a backslash:
str = 'The | operator performs a logical OR'; expr = 'The [\$ \| \#] operator'; [s e] = regexp(str, expr); str(s:e) ans = The | operator
You can no longer declare a variable as persistent more than once within a function.
If you do this, you will need to modify your code.
As of Release 14, the function definition line in a function M-file no longer requires commas separating output variables. However, because this syntax is not compatible with earlier releases, you should always include the comma separators when writing an M-file function that you intend to run on releases both earlier and later than Release 14.
See Comma Separators Not Required in Function Declaration in the Release 14 release notes.
![]() | Mathematics, MATLAB Version 7.0.1 (R14SP1) | Graphics, MATLAB Version 7.0.1 (R14SP1) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |