creating GUI using existing code
9 次查看(过去 30 天)
显示 更早的评论
I just finished a long and complicated program on matlab and should make a GUI for it everything I´ve found is telling me to re-write the code in the guide command or to call a function in the guide. but re-writing the code is impossible and the program doesn't have functions to call, it´s a series of loops and if-s.
2 个评论
Stephen23
2018-4-13
" but re-writing the code is impossible and the program doesn't have functions to call"
If you want to write reliable code that can be integrated into a GUI then use functions. Scripts are basically useless for anything more complex than just testing out a new idea, and should be totally avoided for anything that is "long and complicated". You need to write functions.
Dennis
2018-4-13
i agree with Stephen and with the informations you have given it is hard to provide a better answer. Depending on what your program does and what the gui is supposed to do you could just wrap your code in a function and create a gui that executes it
GUI:
function glac()
%GUI for long and comlicated code
fig=figure;
pushbutton1=uicontrol('Style','pushbutton','String','Execute','callback',@lacf);
end
function lacf(~,~)
%long and complicated code function
disp('Hello Matlab!') %replace this with long and complicated code ?
end
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!