フィルターのクリア

matlab says undefined variable even for defined variables

1 回表示 (過去 30 日間)
Bibek
Bibek 2012 年 2 月 6 日
I created a calc1.m file with 21 variables and few for loops and if statements. I didn't get any problem on running it. In the next step I created another calc2.m file by copying and pasting of calc1.m file and then editing few number values that were in calculation. When I tried to run calc2.m(nothing was left in matlab from calc.1 as I did clc and clear all before running calc2.m), it stopped somewhere in midway, saying one of variable(10th)as undefined variable. More interestingly, I also didn't get any error and got result when running calc.1 even after this. I am wondering why I am getting error only with calc2.m file?

回答 (1 件)

Andreas Goser
Andreas Goser 2012 年 2 月 6 日
My best guesswork with out code is that you use functions and not scripts and that the respective varaibles are just present in a function's workspace.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by