Value assigned to variable might be unused error

댓글 수: 2

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
This is the problem I get when I try to run program with this variables

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2023년 1월 4일

0 개 추천

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."

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2023년 1월 4일

답변:

2023년 1월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by