how to transfer code in gui?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi i wrote a gui program to first read files than make calculations and plot diagrams etc... In Addition on my gui window i created open button to get file from different pfad.
% The OPEN button
btnNumber=6;
labelStr='OPEN';
callbackStr='turbcomp2(''a=6'')';
%Generic Button Information
btnPos=[left/8 yPos-btnHt*10-0.152-btnHt btnWid btnHt];
uicontrol( 'Style','pushbutton',...
'Units','normalized',...
'Position',btnPos,...
'String','OPEN',...
'Callback',callbackStr);
as a callback function i wrote Programm too it Looks subsequent:
[filename,pathname,filterindex]=uigetfile({'*.*','Allfiles(*.*)'},...
'Pick a file',...
'Multiselect','on');
but i dont know how can i Combine These two codes and how can i write second code which is callback as a function? i am new with gui and i could not find any solution. eventhough i did not understand[hObject, eventdata, handles] i searched in Internet however i could not find sufficient Information. Thnaks
4 comentarios
Adam
el 10 de Feb. de 2015
If you are working in a script you cannot use functions.
GUIDE is the easiest way to create a simple GUI rather than manually creating the UI components. It will also create callbacks for you so you don't need to worry about getting the syntax right.
If you want to create the components yourself then just change your code from a script to a function by adding:
function myFunctionName
at the top of the file and
end
at the end of your main function. Then you can define further sub-function as you appear to be doing there for callbacks.
Respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!