How to put GUI in multiple files?

3 ビュー (過去 30 日間)
han han
han han 2020 年 7 月 24 日
回答済み: Walter Roberson 2020 年 7 月 24 日
I am creating a GUI and have an idea
Can I integrate multiple .m into one GUI (.fig)?
Currently I can only make my GUI through the .fig and .m files created by "guide".
But I want to split the main .m into several parts
Is there any way?

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 7 月 24 日
Yes, that is definitely possible.
For GUIDE, the main limitation is that the callbacks that GUIDE generates must be to routines that are inside the primary .m file or which have their own .m file. You cannot create a "library file" of multiple functions that are to be called as callbacks.
Also, if you create your own callbacks, then GUIDE can mess up on managing them.
It can typically turn out to be easiest to let GUIDE create its own callbacks and to create its own function headers in the main .m file, but then to just have at function call the function that actually implements what you want to do
function pushbutton3_Callback(hObject, event, handles)
pushbutton3_Callback_impl(hObject, event, handles)
end
with file pushbutton3_Callback_impl.m for example.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by