Find does not work properly
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Riccardo Tronconi
el 16 de Jun. de 2021
Comentada: Riccardo Tronconi
el 16 de Jun. de 2021
Hi guys! I use the find command but it does not return what I expect.
for i=1:9:500
c=c+1;
d=find(Horizon{i:i+9,8} <= 2);
m=mean(Horizon{i:i+9,8});
report12{c,7}=m;
%if isnan(m)==0
%report12{c,1}=Horizon{i,1};
%report12{c,2}=Horizon{i+9,1};
end
For any value of i and then i+9 my d is always equal to: d= [1,2,3,4,5,6,7,8,9,10,11], of course if each value verifies the condition. What I really expect is filling d with the Horizon row index. let 's say:
d=find(Horizon{440:450,8} <= 2);
d=[440, 441,445,450] assuming only 4 values verifiy the condition
4 comentarios
Respuesta aceptada
Steven Lord
el 16 de Jun. de 2021
Please provide a small sample of the Horizon variable from where you expected the find call to return data but it does not. My suspicion is that the elements in that section of Horizon display as 2 but the stored values are actually slightly larger than 2.
format % default display format
x = 2.000000001 % displays as 2
x <= 2 % but is not less than or equal to 2
Más respuestas (0)
Ver también
Categorías
Más información sobre Entering Commands 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!