Matlab does not find function, after it has found it >50 times
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
I am running a rather large fmincon optimization. The objective function is named 'Main' in my simulation and is located in the same directory as the calling function and all other relevant functions and files. 'Main' is called by the optimizer multiple times. In order to finish the simulation probably about 500 times. After a certain amount of iterations, I get the error, "Main(x) not defined", as if suddenly it could not be found. For the very same simulation, the very same code, this error happens at different number of iterations, sometimes as early as 50, sometimes at the 450ths iteration. It happens earlier when I simultaneously work on the computer. I believe this to be a software error, not a user error, but what can I do about this? I need this simulation to run. Please help.
2 Commenti
Jan
il 11 Mag 2012
Please use meaningful tags, which allow to identify the class of a problem. "error" is not useful.
Risposte (2)
Jan
il 11 Mag 2012
Please explain more details:
- What differs, if the problem occurs after 50 or 450 iterations? Is this the same problem and a deterministic model?
- Please copy the complete error message. The abbreviation "Main(x) not defined" may conceal important details.
- Is the Main.m file included in the Matlab path? If not, is the parent folder the current folder and a function driven by the timer() command changes the current folder?
- Do you modify M-files automatically and trigger a reload by the clear() command?
[EDITED after additional comments]
The Matlab path is the list of folders to search functions in, see "help path".
If the DAT-file reading changes the current folder and the parent folder of the Main.m file is not added to the path (addpath, pathtool, "Set Path..." menu in the command window), you can get the posted error message. But the random appearance is surprising then. Do you use any other TIMER objects?
I suggest to check the path -question at first. Then use the debugger:
dbstop if error
and wait until the error stops Matlab. Then type "which Main -all". Is the Main.m file found?
Are the DAT files closed correctly after reading? You can check this by "fopen -all".
0 Commenti
Vedere anche
Categorie
Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!