Number of rows for given y
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Christopher Schoß
el 7 de Mayo de 2022
Comentada: Voss
el 8 de Mayo de 2022
Hey,
i have loaded a .mat file in my workspace which contains 9x2 double.
First column represents x-values and second column y-vaules.
I have a specific y-values and want to find the number of rows with that y-value.
How can I calculate that?
Thank you!
0 comentarios
Respuesta aceptada
Voss
el 7 de Mayo de 2022
M = randi(10,9,2) % random 9-by-2 matrix of integers between 1 and 10
y = 6; % y value to find in the second column of M
nnz(M(:,2) == y) % number of times y appears in the second column of M
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D 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!