Problem With Generating M Code From Figures

7 ビュー (過去 30 日間)
ridethelightning
ridethelightning 2017 年 8 月 3 日
コメント済み: Jan 2017 年 8 月 3 日
Whenever I try to generate an M code from a figure (file -> Generate Code), any simple one, it keeps giving me this error:
Error defnining waitbar
Output argument "h" (and maybe others) not assigned during call to "waitbar".
Error in makemcode (line 94)
hwait = waitbar(.1,...
Error in filemenufcn (line 58)
makemcode(hfig,'Output','-editor');
Error while evaluating Menu Callback.
Even when I don't define any argument to the variable h, I still receive it. I have tried uninstalling and reinstalling Matlab, and it still gives me the same issue. I'm not exactly sure what is wrong since I don't believe I have changed any of the default settings used for functions and such. Any assistance would be greatly apppreciated.

採用された回答

Jan
Jan 2017 年 8 月 3 日
Do you have any idea, why "waitbar" appears in the message? Is this the toolbox function of Matlab or did you use the same name for the figure or a user-defined function?
which waitbar -all
I guess, that you created an M-file with the header:
function h = waitbar(...)
but h is not defined in this function. Then Matlab tries to call it during the conversion of the figure and fails.
  2 件のコメント
ridethelightning
ridethelightning 2017 年 8 月 3 日
Oh, it turns out that I did have a waitbar function in the same folder that I was working in. It seems that Matlab was indeed just trying to call the function! Renaming it solved the issue. Thanks a lot!
Jan
Jan 2017 年 8 月 3 日
Fine. The forum solves problems with redefined function several times per week, sometimes with M_files, sometimes with local variables. See FEX: UniqueFuncNames for a tool to detect such redefinitions automatically.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by