Is there a way to count within the pattern, different points in a graph before repeating?

1 vue (au cours des 30 derniers jours)
For these graphs shown (both are same), is there a way to find out how many unique points there are before repeating again? For example, this graph shows there are 4 unique points and after that it just repeats the pattern. So I would like to find a way to output the 4 wihtout me manually counting (or no. of unique points depending on the pattern).

Réponse acceptée

darova
darova le 19 Fév 2021
You can round data to integer and use unique
x0 = rand(10,1);
x1 = round(10*x0); % round data to 1 symbol after the dot
unique(x1)
  2 commentaires
Prayash Thapa
Prayash Thapa le 25 Fév 2021
The x-axis values increases but I would like the code to consider the y-axis values which repeats its unqiue values depending on the order. The y-axis is the part I want to consider if that makes sense. E.G. The graph shown has 4 different unique points before it repeats, lets say the unique points are 1,3,4,6 that is shown in the y-axis. Ignoring the x-axis, I would like to know how to display this order of 1,3,4,6.
darova
darova le 25 Fév 2021
unique can return indices too
[C,ia,ic] = unique(A) %also returns index vectors ia and ic using any of the previous syntaxes.
%If A is a vector, then C = A(ia) and A = C(ic).
see more help: LINK

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by