MATLAB: Plot() shows multiple y values for the same x value

data tipplot

Hi,
I imported a very long one row vector of sampling data to matlab. There are some outliers which I like to manually delete. Therefore I plotted the sampling data and searched for the outliers. But it turned out that the data tip doesn't show the exact x value for the outlier. In fact it does show a number of y values for the same x value as in the screenshot. I tried several methods for the x vector but before I realized that the displayed x value is wrong. See my code below. SampleData is a 1×1365252 double vector, so naturally N is 1365252.
Is there a way to get the correct postition without zooming in all the way? It'll be a huge hustle to do that for every outlier.
% Import sampling data
delimiterIn = ' ';
headerlinesIn = 0;
SampleData=transpose(importdata('Messelektronik2020_150er_64OSR_230400Baud_ISR_Sample_2.log', delimiterIn, headerlinesIn));
% determine how many samples there are in total
N=length(SampleData);
% generate x vector
x=linspace(0,N-1,N);
% plot
figure (1);
plot(x, SampleData);

Best Answer

It looks like the coordinate values are limited by precision.
See this answer for an explanation and solution.