Manipular Datatip Matlab

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

function output_txt = myfunction(obj,event_obj)

% Display the position of the data cursor


% obj Currently not used (empty)
% event_obj Handle to event object
% output_txt Data cursor text string (string or cell array of strings).

pos = get(event_obj,'Position');
output_txt = {['F(Hz): ',num2str(pos(1),4)],...
['Amp(A): ',num2str(pos(2),4)]};

% If there is a Z-coordinate in the position, display it as well


if length(pos) > 2
output_txt{end+1} = ['Z: ',num2str(pos(3),4)];
end

%% Copiar e colar no command window (janela branca)


cursorMode = datacursormode(gcf);
dataTipsH = cursorMode.DataCursors;
set(dataTipsH,'FontSize',14)

{\bf{x}}_{\it{HT}}

h = findobj(gca,'Type','line');
x=get(h,'Xdata');
y=get(h,'Ydata');

h1 = findobj(gca,'Type','line');
x1=get(h1,'Xdata');
y1=get(h1,'Ydata');

h2 = findobj(gca,'Type','line');
x2=get(h2,'Xdata');
y2=get(h2,'Ydata');

h3 = findobj(gca,'Type','line');
x3=get(h3,'Xdata');
y3=get(h3,'Ydata');

plot(x1,y1);hold on
plot(x2,y2,'r');hold on
plot(x3,y3,'k');
legend('without fault','short circuit','unbalance phase')

You might also like