Why do I need to run a file several times in MATLAB before it stops throwing an error?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have been trying to debug this weird bug where I run a script in matlab and it says that it cannot find some function that I have clearly defined in a folder and also obviously imported to the running script. However, after running the script a few times it suddenly accepts it knows where the location of my function is and runs. I find this really strange because that shouldn't be happening because imports are deterministic functions, so I have no idea why running it multiple times should make a difference.
----
To reproduce my bug you can find my code in my project's [github page][1] https://github.com/brando90/research. Go/cd to the folder:
`research/HBF_mat_lib/HBF1_multivariant_regression/om_simulations/h_add_cv`
and
run:
`test_debug_script`
in MATLAB.
It show throw an error:
Undefined function 'learn_HBF1_SGD' for input
arguments of type 'HBF1_parameters'.
Error in get_best_trained_hbf1_model (line 37)
[ mdl_params, errors_train, errors_test ] =
train_func( X_train, y_train, mdl_params,
iterations,visualize, X_test,y_test,
eta_c,eta_t, sgd_errors);
Error in test_debug_script (line 11)
get_best_trained_hbf1_model(slurm_job_id,
task_id)
Error in run (line 96)
evalin('caller', [script ';']);
but if you try running it enough times it runs as it should.
----
Things I've tried to clear this bug is clear my matlab environment, restore my path to normal, at this point I have no idea what I can do because I have also printed out what path is before executing stuff and the folder seems to be in my path variable. At this point I have no idea what I can do and why after running a few times it runs, it should ALWAYS fail but it does not...
this post is: http://stackoverflow.com/questions/35400295/why-do-i-need-to-run-a-file-several-times-in-matlab-before-it-stops-throwing-an
[1]: https://github.com/brando90/research
0 Commenti
Risposte (1)
Image Analyst
il 15 Feb 2016
Why do you use evalin()? Somehow I manage to write hundreds of MATLAB programs without ever needing to use that function.
Did you use cd() in your program? It sounds like what the FAQ describes: http://matlab.wikia.com/wiki/FAQ#Where_did_my_file_go.3F_The_risks_of_using_the_cd_function.
Attach your file(s) here with the paperclip icon. Make it easy for us. We don't like having to go to some third party external site to get your code when we're already here in MATLAB Answers and could get it conveniently right here. (Call me lazy, but I didn't go get your code.) Make it easy to help you not hard.
3 Commenti
Vedere anche
Categorie
Scopri di più su Startup and Shutdown 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!