how to programmatically make a GUI

hi guys
I really need everyone's help on this. I've been trying to make a gui so that i can take the data from my m file and plot it so that i can grid, pan, zoom, scroll, select different categories to show on the plot and etc . I've tried watching every video and reading up on how to make it. I just am not able to make it correctly. I need to finish this code as soon as possible so i would appreciate if you got back to me with any suggestions that you may have.
Thank you so much

15 Comments

Read AppDesigner or Guide.
In Your MATLAB Command window, type
>>appdesigner
or
>>guide
"how to programmatically make a GUI"
Writing a GUI involves lots of reading documentation:
  • want a button: go and read the uicontrol help.
  • want to plot data: go and read the plot / surf / ... help.
  • etc.
I would recommend avoiding GUIDE, just write it yourself using nested functions.
Hi Stephen
Thank you for your comment. I tried making it myself but after I make the functions i have trouble reading the variables form the workplace. so i thought I would put everything in one big function and introduce(load) the variables in the beginning but I cant seem to be able to do it correctly!
None of us has time to write a textbook on all the ways to write a gui. You need to ask specific questions. Post code and show the error message.
"so i thought I would put everything in one big function and introduce(load) the variables in the beginning but I cant seem to be able to do it correctly!"
Here is a simple GUI that accepts input arguments, processes them, and then returns (optionally when the GUI is closed, using waitfor):
that was really helpful Stephen. I appreciate it!
Hi Walter thanks for your interest in helping. please find the code bellow. I wand to be able to load all the variables (ex: A, Time_interval, BR10_start,...) from my m file.
fprintf('\nPlotting Data...\n');
h=figure('units','normalized','outerposition',[0 0 1 1])
Time_interval = (0:(length(A)-1))/B;
plot(Time_interval,A);% plot with initial zoom
axdrag
ylim([70 105])
hold on;
grid minor
xtick=[0:10:1000000]
toc;
ButtonH=uicontrol('Parent',h,'Style','pushbutton','String','Limits','Units','normalized','Position',[0 0 0.1 0.1]);
set(ButtonH,'Callback',@hlineCallback);
ButtonA=uicontrol('Parent',h,'Style','pushbutton','String','less than 90','Units','normalized','Position',[0 0.1 0.1 0.1]);
set(ButtonA,'Callback',@BRCallback);
function hlineCallback(ButtonH,event)
hline(98,'--g')
hline(95,'--g')
hline(90,'--g')
hline(80,'--g')
end
function BRCallback(ButtonA,~)
load(my file with all the variables) %but there are too many variables %to load here
% I get this error:"Too many output arguments."
X1_start=[BR10_start BR60_start BR120_start BR180_start BR300_start]/B;
X1_End=[BR10_end BR60_end BR120_end BR180_end BR300_end]/B
vline(X1_start, '-.y');
vline(X1_End, '-.y');
% I get this error here: "Undefined function or variable 'BR10_start'."
end
Please show the exact load() line that you are using, the one that is giving the error about too many output arguments.
load(filename,'SO10_start', 'SO60_start', 'SO120_start', 'SO180_start', 'SO300_start', 'SPO2_SF','SO10_end', 'SO60_end', 'SO120_end', 'SO180_end','SO300_end', 'SPO2_SF')
I'm not even sure if I should use load. I would appreciate any other suggestions. Thanks in advance
That command would not give an error about too many output arguments -- not unless you had a function named filename() that did not have any output arguments.
this is the message it gives me
Error in Oxygen_interval>ARCallback (line 1017) load(Medi_oxygen_interval_program_updated,'AR10_start', 'AR60_start', 'AR120_start', 'AR180_start', 'AR300_start', 'SPO2_SF','AR10_end', 'AR60_end', 'AR120_end', 'AR180_end','AR300_end', 'SPO2_SF')
Error while evaluating UIControl Callback.
Please do not close Questions that have an answer.
What is Medi_oxygen_interval_program_updated ? It does not appear to be a character vector holding a file name.
sorry I think I did that by accident
that's the name of the file
Error in Medi_oxygen_interval_program_updated>ARCallback (line 1017) load(Medi_oxygen_interval_program_updated,'AR10_start', 'AR60_start', 'AR120_start', 'AR180_start', 'AR300_start', 'SPO2_SF','AR10_end', 'AR60_end', 'AR120_end', 'AR180_end','AR300_end', 'SPO2_SF')
My guess is
load('Medi_oxygen_interval_program_updated.mat', 'AR10_start', 'AR60_start', 'AR120_start', 'AR180_start', 'AR300_start', 'SPO2_SF', 'AR10_end', 'AR60_end', 'AR120_end', 'AR180_end', 'AR300_end', 'SPO2_SF')

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

Asked:

on 30 Oct 2018

Commented:

on 2 Nov 2018

Community Treasure Hunt

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

Start Hunting!