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

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

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 .
Tonight I will start to learn :) Thanks

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

I will give it a look, I come back to this answer if I won't figure it how how to implement it. Thank you
You're welcome, but please click "Accept" when you're satisfied the question has been answered.
Can i accept it and come back to ask more things on the accepted answer? If yes i can accept it right now.
Adam
Adam on 19 Oct 2017
Edited: Adam on 19 Oct 2017
Yes, you can, if it answers the question you asked and you just want some extra clarifications.
Questions with an already Accepted Answer will be far less likely to attract new answers or new contributors to answer further questions in the thread, but that is all. Usually the person whose answer you have accepted will happily answer relevant questions if you don't understand the answer fully.
Yes, I will try to answer follow up questions if there are any.
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);
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 Develop Apps Programmatically 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!