How to resolve an error message: Unrecognized function or variable

I always get an error of Unrecognized function 'DA' when I run the code for the first time.
The error disappears in subsequent runs. What could be the reason.
see a sample of the code.
%% ENTER DATE, MONTH, YEAR AND HOUR
DA.Day = 1;
DA.Month = 06;
DA.Year = 2021;
DA.tLST = 7;
DA.ls = 60;
[tim, yprime] = Balloondynamics(dtspan,In0,wind, DA, I, B);

5 件のコメント

Image Analyst
Image Analyst 2021 年 8 月 13 日
This code will run fine the first time. You must be running a version where somehow DA never got assigned, but we can't tell because, unfortunately, you forgot to attach ESC_simulation.m.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 8 月 13 日
It seems that you may have an M-file called DA in your current or working (accessible) directory/ies. Check it.
Walter Roberson
Walter Roberson 2021 年 8 月 13 日
No, if there was a DA.m in the path and no variable with that name, then it would not have been an unrecognized function: it would in that case have attempted to execute DA with no arguments, and it would have errored if DA did not return any values.
Telema Harry
Telema Harry 2021 年 8 月 13 日
I have seen the bug. It took a while but I was able to find it.
after the DA variable, I called another file to load weather data.
That file clears all the previous variables using the function: clearvars -except data
In the next attempt, the program uses the stored 'data' and it is not runing the weather data file again.
Problem solved. Thanks
Rik
Rik 2021 年 8 月 14 日
That sounds like you just learned why functions are useful.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWeather and Atmospheric Science についてさらに検索

製品

リリース

R2021a

質問済み:

2021 年 8 月 13 日

コメント済み:

Rik
2021 年 8 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by