how to plot the specific selection from listbox into axes1
Afficher commentaires plus anciens
Dear Users,
I am new to GUI of Matlab. In some part I found the success but in some I am stuck. It is difficult to come out with solutions as I am thinking.
I have 2 pushbutton and named them import and delete. 1 listbox1 and 1 axes1.
I wanted to import all the desired files and get them plotted into axes1. At the same time I will have the list of files displayed in listbox1. I got the success in doing it.
My problem is:
- I want to click on one particular file in listbox1 and get the display on axes1 plotted with red colour (overlap on earlier plot).
- I want to delete the selected file based on my observations.
3 I want to apply processing on remaining dataset.
Thank you for your help and suggestion.
5 commentaires
Mario Malic
le 8 Sep 2020
Modifié(e) : Mario Malic
le 8 Sep 2020
Unfortunatelly, I didn't see that you use GUI(haven't had the coffee yet). I wrote an answer for solving this with App Designer which might give you hints for your GUI.
Your problems need to be explained more carefully, each of those should be asked separately.
"1. I wanted to import all the desired files and get them plotted into axes1." If you go on your UIAxes1 in component browser, see the tab called Multiple Plots, option is Next Plot - Add. Every plot function call will be added on the UIAxes.
"2. I want to click on one particular file in listbox1 and get the display on axes1 plotted with red colour (overlap on earlier plot)." Does this earlier plot have already data from the file you want to plot? If yes, then can rather just change the color of observed data, if not then here's an idea.
Add a value changed callback on ListBox
% Value changed function: ListBox
function ListBoxValueChanged(app, event)
app.ListValue = app.ListBox.Value; % Set the value as a property
PlotSelection(app)
end
Helper function PlotSelection
If you save your files in array X whose rows correspond to each file, you can plot it this way
function PlotSelection(app)
plot(app.UIAxes, app.x(app.ListValue,:), app.y(app.ListValue,:), 'r');
end
"3. I want to apply processing on remaining dataset." I don't have a clue of what you want to do here.
Amit Kumar
le 8 Sep 2020
Mario Malic
le 8 Sep 2020
I guess you didn't have your coffee either :)
You need two buttons, one for plotting and one for deleting . When the value from list is selected, clicking on a button will trigger a callback.
% Button pushed function: Button
function ButtonPushed(app, event)
PlotSelection(app)
end
For deleting a particular data from the plot, I can't tell exactly how to do it, you should search for other questions as it's a common question.
% Button pushed function: Button1
function Button1Pushed(app, event)
DeleteSelection(app)
end
Amit Kumar
le 8 Sep 2020
Mario Malic
le 8 Sep 2020
Modifié(e) : Mario Malic
le 8 Sep 2020
Sorry, can't really help with GUI, since I have never used it.
That what I've written are just ideas how to solve your problem, it's possible to implement them in GUI, but I have never worked with it.
Réponses (0)
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
