Matlab 打印以突出显示所选数据

Matlab 打印以突出显示所选数据,matlab,user-interface,plot,handles,Matlab,User Interface,Plot,Handles,我想创造一些类似的东西。区别在于:我的表只有一列,这是我为获取数据而更改的变量。我已经摆好桌子并开始工作了,我所做的大部分工作都很有效,但我似乎只能一次突出一件事。这就是我所拥有的: % 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 = p

我想创造一些类似的东西。区别在于:我的表只有一列,这是我为获取数据而更改的变量。我已经摆好桌子并开始工作了,我所做的大部分工作都很有效,但我似乎只能一次突出一件事。这就是我所拥有的:

% 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
我已经玩了几个小时了,我真的不知道我的问题是什么。很明显,我们非常感谢您的帮助!:-)