Borrar filtros
Borrar filtros

try/catch warning

4 visualizaciones (últimos 30 días)
DAD
DAD el 4 de Oct. de 2011
Editada: Guillaume el 19 de Jun. de 2018
I got the warning message like this while used in MATLAB 2007.........
??? Warning: File: histfit1.m Line: 62 Column: 7
This try-catch syntax will continue to work in R2007a,
but may be illegal or may mean something different in future releases of MATLAB.
See Release Notes for MATLAB Version 7.4, "Warning Generated by try-catch" for details.
Please help me...........

Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Oct. de 2011
You didn't write histfit1, so don't worry about it. When you get to a version of MATLAB where the syntax used internally actually makes a difference, TMW will have changed their routine.
If it really bugs you, apply the solution in the release notes that the warning refers to. You can find that here
  2 comentarios
Walter Roberson
Walter Roberson el 4 de Oct. de 2011
As my previous reply does not appear to have been satisfactory for you, I will point you to the documentation as how you can turn the warning off -- which will merely hide the warning rather than dealing with it, and will probably be a waste of time unless the warning is occurring over and over in a loop:
http://www.mathworks.com/help/techdoc/matlab_prog/f3-39022.html#f3-39056
See in particular
warning off last
DAD
DAD el 4 de Oct. de 2011
sorry i never wrote histfit1 ........

Iniciar sesión para comentar.

Más respuestas (1)

Hamid Moazed
Hamid Moazed el 19 de Jun. de 2018
Editada: Guillaume el 19 de Jun. de 2018
For convenience here is the text (the link in above answer is broken):
To accommodate future changes in the MATLAB error-handling capabilities, there is a new restriction to the syntax of the try-catch block. When the first MATLAB statement that follows the try keyword consists of just a single term (e.g., A as opposed to A+B) occurring on the same line as the try, then that statement and the try keyword should be separated by a comma. For example, the line try A
should be written as either
try, A
or on two lines as
try
A
This affects only single-term statements. For example, the following statement continues to be valid:
try A+B
The same holds true for the catch keyword and a single-term statement following the keyword on the same line. A valid try-catch statement of this type should be composed as follows:
try, A, catch, B, end
If you omit the commas following try and/or catch, your code will continue to operate correctly. However, MATLAB will issue a warning: try statements, catch statements, end
Warning: This try-catch syntax will continue to work in R2007a, but may be illegal or may mean something different in future releases of MATLAB. As with previous releases, the recommended syntax for a try-catch block is as follows:
try
try_statements
catch
catch_statements
end
Note
Due to a bug in the R2007a release, the warning for a catch followed immediately by a single term is thrown as an error, even though the text of the message says that it is a warning.

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by