Select lines from table to plot in MATLAB GUI
9 views (last 30 days)
I am loading several data to plot in a matlab gui (built in GUIDE).
While I am loading the data I have built a table that it is updated with the titles of each spectrum that is loaded.
Is it possible to select multiple rows of the table and update the plot with the selected spectra only???
If yes could anyone provide me with any hint?
Or at least how could I export the INDEX of the selected table rows?
Please find attatched the GUI snapshot for better understanding of my question!
Thank you in advance
_ on 21 Jan 2022
You can create one line for each spectrum (this would probably be in the plot button Callback) and then set the visibility of the lines in the table's CellSelectionCallback function. Something like the code below. You can copy/paste the code and run it on your system to see how it works, and then take the relevant parts and adapt them to your existing code. (I can't really demonstrate the table cell selection callback here, as far as I can tell.)
handles.figure = figure();
fpos = get(handles.figure,'Position');
N = 7;
handles.table = uitable( ...
'Position',[fpos(3)-160 10 150 fpos(4)-20]);
handles.axes = axes( ...
'Position',[10 10 fpos(3)-180 fpos(4)-20]);
colors = get(handles.axes,'ColorOrder');
handles.lines = cellfun(@(x)line( ...
handles = guidata(src);
idx = evt.Indices(:,1);