Borrar filtros
Borrar filtros

Value assigned to variable might be unused error

10 visualizaciones (últimos 30 días)
Valters
Valters el 4 de En. de 2023
Respondida: Steven Lord el 4 de En. de 2023
  2 comentarios
Valters
Valters el 4 de En. de 2023
I tried to do something but variables not found, I done everything written but nothing changed, this error occurs to other my matlab document which line not working with this variables
Valters
Valters el 4 de En. de 2023
This is the problem I get when I try to run program with this variables

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 4 de En. de 2023
Note that this is not an error. This message is a Code Analyzer warning indicating that there may be a problem with this code. It may indicate that you made a typo on a later line (referring to a variable S1 when you intended to refer to the variable S defined on this line), that you computed something but then overwrote that result (preventing you from using that computed value later in your code), or indicating that you may not need the results of that computation (which may allow you to avoid computing it in your code, potentially saving time and/or memory.)
Or it could be that you intended to overwrite the result on a later line. Perhaps the only reason you needed to compute it is to display it in a report, for example.
If you know why you're assigning to that variable but not using it, you can suppress the Code Analyzer message by right-clicking on the underlined code. The context menu should have options to supress the warning, basically telling Code Analyzer "I know what's going on here, and it's okay." much like telling a barking dog "It's okay, that's just the mail carrier doing their job."

Categorías

Más información sobre Debugging and Analysis en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by