Guide - choose which plot to show on a figure and save

4 views (last 30 days)
Hi everyone, This is the FIRST question of a series of questions to help me complete a project. The Second question can be found here .
Here is what I CAN now do with the script I have written (not GUI yet).
  1. I measure some tensile properties of polymers and stock the results in a text file (external software).
  2. I read the informations I need in MATLAB and I print them on a plot (very easy script).
What I would like to have as a final product can be seen on the picture:
  1. Push button (CB1) that allows the user to choose the directory were the files are (uigetdir).
  2. Some kind of selection box in which are listed all the text files found in the chosen directory with a switch/checkbox that can be switched ONorOFF/checked.
  3. A graph on which all the selected/checked txt files will be plot (it has to auto update when a new selection is made on the selection box).
  4. A button (CB2) to save the actual plot as image.
  5. More function will be implemented once these previous 4 will be working.
Can you tell me which available GUIDE button/box will give this result? I am kind of new at this, any advice will be well accepted.
Thank you for your help and time.
Michael
  2 Comments
KL
KL on 19 Oct 2017
You seem to be clear about what you want, now it's just time to start building the interface and then write the codes for callbacks. Get started here .

Sign in to comment.

Accepted Answer

Matt J
Matt J on 19 Oct 2017
Edited: Matt J on 19 Oct 2017
The check box selections of Name?.txt can be implemented with a table, specifically by using the ColumnFormat property to make one of the columns type logical.
For CB1, CB2 --> PushButtons
For the plot --> axes object maybe inside a panel.
For the Save in... --> EditText box
For Choose path ---> StaticText box
  7 Comments
Michael Daldini
Michael Daldini on 25 Oct 2017
Edited: Michael Daldini on 25 Oct 2017
Ok, I got to this point: I have the checkboxes and the fila names. Now I will have to add a plot to the graph (let's call it axes) when the box is checked and to take it off if unchecked. Will the code be faster if I put a button that will activate the modifications insteate of a continuous update of the plot?
This is the code right now:
function PB1_Callback(hObject, eventdata, handles)
dname = uigetdir('C:\');
if dname == 0
return
else
cd(dname)
end
F = dir('*.TRA');
for i = 1:length(F)
names{i,1} = F(i,1).name;
end
% Create cell of same length of names
checkboxes = cell(length(names),1);
% Fill it with the 'false' statement
checkboxes = cellfun(@(x) false ,checkboxes,'un',0);
% Create the two columns for uitable
mydata =[checkboxes names];
% Set the uitable
columneditable = [true false];
columnformat = {'logical', 'char'};
set(handles.uitable2,'data', mydata,...
'ColumnFormat', columnformat,...
'ColumnEditable', columneditable);%,...
%'CellEditCallback',@fcttodefine);
Matt J
Matt J on 25 Oct 2017
Will the code be faster if I put a button that will activate the modifications insteate of a continuous update of the plot?
Probably. That way it only has to do the rendering once.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!