in the below mentioned code, i get an error in finding some elements (not in all) : 0×1 empty double column vector
Mostrar comentarios más antiguos
m=41;
n=51;
dx=0.0500;
dy=0.0500;
for i=1:m
for j=1:n
x(i,1)=(i-1)*dx;
y(j,1)=(j-1)*dy;
end
end
k=find(x==0.3)
Respuesta aceptada
Más respuestas (1)
k = find(abs(x-0.3)==min(abs(x-0.3)))
2 comentarios
ravi shukla
el 15 de Ag. de 2023
Asking for strict equality of expressions is dangerous because of floating point arithmetic. See @Steven Lord 's answer for a more detailed explanation.
Categorías
Más información sobre Logical 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!