MATLAB showing error : undefined variable

7 ビュー (過去 30 日間)
PIYUSH CHOUDHARY
PIYUSH CHOUDHARY 2019 年 12 月 1 日
回答済み: Image Analyst 2019 年 12 月 1 日
So I was just solving a system of linear inequations using simple for loops and if statements as shown in the image. But upon running an error pops up, saying that one of the variable is undefined. I could not bring myself to solve the issue because I do not understand why is it saying so. All looks good to me. Please help.
Screenshot (104).png

回答 (1 件)

Image Analyst
Image Analyst 2019 年 12 月 1 日
Line 22 assumes that cz got assigned. But if you look at line 7 you'll see that the criteria is never met and so line 8 never gets executed and so cz is not assigned a value before it comes time to use it in line 22. Why is that criteria not met? Tha's for you to figure out.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by