listbox with exclude option

Hi all,
I have a listbox in my GUI which allow user to exclude certain data points before plotting. My current code is roughly listed as following:
datasetFull = get(hObject,'UserData');
datapointKept=get(handles...,'UserData');
for m = datapointKept
datasetFilter{m}=datasetFull{1,m};
end
datasetForPlot = datasetFilter(~cellfun('isempty',datasetFilter)); % delete empty array
plot(datapointKept,datasetForPlot);
If i have 3 data points in total, I want to exclude data point #1, choose to plot data point#2/#3 using this coding. However, the outcome is... it is still plotting data point #1/#2, it does skip the correct data point, instead it starts from #1 till 'datapointKept' progressively.
May I know how to solve this problem? Thanks!

Risposte (1)

Jan
Jan il 23 Nov 2015

0 voti

Did you use the debugger to examine the contents of datapointKept? I guess there is a bug in the code, when the corresponding UserData are set, but as long as this part is not posted in the forum, it is impossible to find the problem.

Richiesto:

PF
il 23 Nov 2015

Risposto:

Jan
il 23 Nov 2015

Community Treasure Hunt

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

Start Hunting!

Translated by