How to create input text box in GUI matlab
    8 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
I need to make a GUI for a certain code with the following requirements:
1.it should select a text file from the directory (Browse button).
2. we have to enter a data in the text box ( and should write beside it as a static this text: (Enter (from the above Context array) the queries GO terms seperated by comma(s): ).
3.I should press the button Find the RKC.
4. the RKC(s) should be shown as a result on the GUI ( in the normal matlab code the result is fprintf('RKC = { %s , %s }\n',pc,cc); where pc and cc are the results from the code.
I did create my own GUI code, but there are some problems:
1.in the function 'RKCCallback' , it doesnot take the selected text file from the 'GOCallback' function above it.
2. I don't know how to create the statictext box beside the Browse button which I should write on it: (Enter (from the above Context array) the queries GO terms seperated by comma(s): ).
3. I don't know how to make an input box that I should enter the data to run and to find the RKC ( in the normal matlab code it is : n=input('Enter (from the above Context array) the queries GO terms seperated by comma(s): ','s'); .
The GUI code:
function My_GUI
    clear all
    close all
    clc
plotbutton=uicontrol('Style','pushbutton',...
    'Position',[400 300 100 30],...
    'String','Browse',...
    'Callback',@GoCallback);
function GoCallback(source,eventdata)
          [FileName,PathName]= uigetfile('*.txt','Browse')
   end
%set push button for parameter A
RKCbutton=uicontrol('Style','pushbutton',...
    'Position',[400 100 100 30],...
    'String','Find the RKC',...
    'Callback',@RKCCallback);
%Set main figure properties.
bgcolor=[0.8 0.8 0.8];
frac2main=figure('Visible','off',...
    'Position',[0 0 700 480],...
    'MenuBar','none',...
    'Name','Melanoma Detection',...
    'NumberTitle','off',...
    'Resize','off',...
    'Color',bgcolor);
'*.txt','Browse'
%set textRKC for result
textRKC=uicontrol('Parent', frac2main,...
    'Style','text',...
    'Position',[220 300 100 30],...
    'String','0',... 
    'FontWeight','demi',...
    'FontSize',11,...
    'Backgroundcolor',[1 1 1],...
    'Foregroundcolor',[0 0 1]);
function RKCCallback(source,eventdata)
          s={};
           fid = fopen('gos.txt'); 
    tline = fgetl(fid); 
        while ischar(tline) 
           s=[s;tline]; 
           tline = fgetl(fid); 
        end 
The rest of the code....
.
.
.
.
.
.
     set(textRKC,'string',pc,cc)  % the results which should shown
  end
0 Commenti
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Adding custom doc in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!