creating GUI using existing code

9 visualizaciones (últimos 30 días)
loma elmossallamy
loma elmossallamy el 13 de Abr. de 2018
Comentada: Dennis el 13 de Abr. de 2018
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
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
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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by