plz anyone solve the following question for me in matlab and reply quick.regards
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
if X=[-4 -1 0 2 10] and Y=[-5 -2 2 5 9],find the index of elements of "X" that are greater than corresponding value of "Y".
Respuestas (2)
Conrad
el 5 de Nov. de 2012
Try this
X=[-4 -1 0 2 10];
Y=[-5 -2 2 5 9];
[~,idx] = find(X>Y);
0 comentarios
Rick
el 5 de Nov. de 2012
Editada: Rick
el 5 de Nov. de 2012
If the scale of X and Y is the same, you could use a "for" loop to go through every element.
for i=1:numel(X)
if X(i) > Y(i)
% Do something
end
end
or you could use the function "gt"
type "help gt" in matlab without quotes for more details
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing 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!