Cannot find function figure1_KeyPressFcn in GUI code file
古いコメントを表示
In the GUIDE editor, when I right click on the figure and go to add a callback, pressing the KeyPressFcn callback selection yields a msgbox error which says "Cannot find function figure1_KeyPressFcn in GUI code file C:". Note that there is no path given after "C:". When a keypress event occurs during runtime, there is an error printed to console which states "error using feval ... undefined function 'figure1_KeyPressFcn' ..."
How should I go about fixing this error?
3 件のコメント
Richard Moyse Fenning
2018 年 1 月 19 日
I'm having the same issue, so I would appreciate an answer. Did you find a work-around Stephen?
Stephen
2018 年 1 月 19 日
Richard Moyse Fenning
2018 年 1 月 19 日
Thanks Stephen.
Following an answer to a different question, I did 'save as' on the fig and it seems to work OK now. I'm not 100% sure the two are related though :)
回答 (1 件)
Kai Tanaka
2019 年 8 月 1 日
0 投票
I also ran into this issue and was able to find a way to resolve it. It appears the error can be caused by creating the callback code and then deleting it. In order to get GUIDE to regenerate the code:
- Rename the 'Tag' of the offending GUI element inside Inspector
- Save the GUI
- Right click the element in the figure, and select 'view callbacks'
The code was now generated in my GUI .m file and the error went away.
カテゴリ
ヘルプ センター および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!