Error with dynamically created m-files
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
As part of a function I have written called "make_odf_pos.m" I have a section of code that writes a helper function to a temporary m-file, "tp10e78e1b_3019_4268_b6a7_f9ade665fc01.m", and then calls the helper function later during execution. However when I call "make_odf_pos.m" I get the following error message:
??? Undefined function or method 'tp10e78e1b_3019_4268_b6a7_f9ade665fc01' for input arguments of type 'double'.
Error in ==> make_odf_pos at 78
fsample = tp10e78e1b_3019_4268_b6a7_f9ade665fc01(wsample,tsample,psample,c);
But if I then call "make_odf_pos.m" again it runs fine without the error. It is as if after creating the temporary file, it is having trouble recognizing that it exists or loading it into memory or something until I exit "make_odf_pos.m" and run it a second time. Does anyone know why this would be and how to fix it?
Thank you for your time!
Sincerely, Oliver
0 Kommentare
Akzeptierte Antwort
Nirmal Gunaseelan
am 4 Aug. 2011
This is because there is no guarantee that there is a refresh of your file path and your new file may or may not be picked up. A forced REHASH before opening the file should fix the issue.
Weitere Antworten (1)
Fangjun Jiang
am 4 Aug. 2011
This is basically the same question as your previous one. Did Jan's solution solve the problem?
2 Kommentare
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!