Value assigned to variable might be unused error
이전 댓글 표시
답변 (1개)
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에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

