Hello dear community,
for the moment I'm looking for a solution to make the my plots better looking than plotting every figure in separate windows e.g.
I have two solutions in mind, which I don't know are the most optimal ones.
1. Solution. Creating a figure window from where the user can choose of the x and y variable that has to be plotted. The figure stays open and the the user can change the inputs as he wants.
2. Creating a GUI where all the different cases i provide of plotting (e.g. "load vs. time", "extension vs. Time" etc.) The user can click on the buttons and the figure will appear.
Since I'm quiet new to the GUI, I'm not really good at understanding it fully (e.g. callback functions,..)
The code i wrote now, for what i had in mind for the first solution looks like the following:
if truefunction myplot(out)% out is a struct containing all informations from the measurement
% Create a figure and axes
header=fieldnames(out);figure;ax = axes('Units','pixels');% Create pop-up menu X-Value
popup_x = uicontrol('Style', 'popup',... 'String',header,... 'Position', [20 340 100 50],... 'Callback', @changex);% Create pop-up menu (Y-Value
popup_y = uicontrol('Style', 'popup',... 'String', header,... 'Position', [120 340 100 50],... 'Callback', @changey)endfunction changex(source,eventdata,out) % get the x id
x = get(popup_x,'Value') % get the attribute id
y = get(popup_y,'Value') val = source.Value; header = source.String; plot(out.(header{val}),out.(header{val}));end
I know the code is messy, i left some things that i tried inside of it, but I'm not sure how to use it, I'm really sorry…
I thank you all in advance for your help 🙂
Best Answer