listbox with exclude option

1 view (last 30 days)
PF
PF on 23 Nov 2015
Answered: Jan on 23 Nov 2015
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!

Answers (1)

Jan
Jan on 23 Nov 2015
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.

Categories

Find more on Graphics Object Programming 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!