creating GUI using existing code
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Stephen23
el 13 de Abr. de 2018
" 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
el 13 de Abr. de 2018
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
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!