How to extract corresponding values of x-axis based y-axis values.
Mostrar comentarios más antiguos
Good day,
Could someone please help me on how to extract corresponding values of x-axis based on y-axis values?
x=[1,3,4,8,3,5,6,4,5,6,7,9]
y=[3,5,6,7,4,5,6,7,8,0,3,4]
I would like to extract the corresponding values of these elements; 5,6,7,4,5,6,7(values from y-axis) in x-axis.
I only know how to find a corresponding single value not multiple values.
Thanks
6 comentarios
Matlab 101: Indexing
The solution will depend on how you chose those y-values in the first place.
BTW, it looks like you're missing 2 commas in your example.
AUWAL ABUBAKAR
el 1 de Jul. de 2020
AUWAL ABUBAKAR
el 2 de Jul. de 2020
Adam Danz
el 2 de Jul. de 2020
That's clearer. See the answer I added.
AUWAL ABUBAKAR
el 3 de Jul. de 2020
Respuesta aceptada
Más respuestas (1)
maybe use ismember:
idx = ismember(y, [5,6,74,5,67])
xvalues = x(idx)
P.S. sorry for the editing, I now read your problem correctly
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!