我想创建类似this的内容。不同之处在于:我的表只有一列,这是我为获取数据而更改的变量。我有桌子设置和工作,以及我的大部分工作,但我似乎只能一次突出一件事。这就是我所拥有的:
% Set up plots etc
for a = 1:length(data);
xAxis = data{a,1}(:,X);
yAxis = data{a,1}(:,Y);
plot(graph,xAxis,yAxis);
% Visible data
hilite = plot(graph,xAxis,yAxis,'o-','LineWidth',2,'HandleVisibility','off','Visible','off');
% Invisible data, to be highlighted later
hold all
end
hold off
% Data table callback function
function dataTable_Callback(hObject, eventdata)
set(hilite,'Visible','off')
names = get(hObject,'Data');
select = eventdata.Indices(:,1);
for d = 1:length(select)
group = select(d);
xAxis = [];
% makes sure that previously selected data is removed
yAxis = [];
xAxis(:,d) = data{group,1}(:,X);
% if I remove the semicolon and let MATLAB print this data, I always get
the correct data in the correct columns, adding and subtracting them when
I select them
yAxis(:,d) = data{group,1}(:,Y);
set(hilite,'Visible','on','XData',xAxis(:,d),'YData',yAxis(:,d))
legend(hilite, num2str(names{select,1}(1,1)));
end
end
我现在已经玩了几个小时了,我真的无法弄清楚我的问题是什么。任何帮助显然非常感谢! : - )