Locating entered vector values

1 visualización (últimos 30 días)
Jose Grimaldo
Jose Grimaldo el 16 de Feb. de 2020
Comentada: Stephen23 el 16 de Feb. de 2020
I have a vector x=(0:1:9) and the user has to input a vector (single integers). How can i locate the values the user input in the x variable? Can it be done without using loops?
x=[0 1 2 3 4 5 6 7 8 9];
% User input vector
a=[1 4 0 0];
% I was trying this but it fails when i run the code
>> [r,c]=find(ColorNum(rst(1:end)));

Respuesta aceptada

Bhaskar R
Bhaskar R el 16 de Feb. de 2020
ind = find(ismember(x, a))

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by