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

1 visualización (últimos 30 días)
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).

Respuesta aceptada

darova
darova el 19 de Feb. de 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 comentarios
Prayash Thapa
Prayash Thapa el 25 de Feb. de 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 el 25 de Feb. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by