1

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

the fowlloing is a pic of how I want my GUI to appear ( there also should be the result box but I dont know how to dreaw it at the bottom)

enter image description here

Thanks

1 Answer 1

2

I would suggest that you go through this super post on MATLAB file exchange. This will help you to deeply understand the mechanism behind these GUIs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.