embedded if statement not working
Mostrar comentarios más antiguos
I have a large CSV file used for data collection. The sensor data is recorded as long as the power is on. When the test is initiated, the value of a cell changes to 3. I have created a simple embedded if statement that seems to be missing the values. Any help would be appreciated. Thanks
untitled = <5561x129> double %<---- Raw Data
a=1;
n=length(untitled);
for j=1:n
if untitled(n,54) ==3;
test_data(a,:)=untitled(n,:);
a=a+1;
end
end
but if I enter in the Command Window,
>> untitled(1680,54)
ans =
3
Thanks
Respuesta aceptada
Más respuestas (2)
Chris
el 3 de En. de 2013
0 votos
Jan
el 3 de En. de 2013
At first your code can be abbreviated:
index = (untitled(:, 54) == 3);
test_data = untitled(index, :);
Now it has not been explained, why you think that something is missing. Is test_data empty after the code ran?
Is the value exactly 3 or is it 2.999999999999999, which is displayed as 3 in the command window? Please test this:
untitled(1680,54) - 3
Categorías
Más información sobre Hypothesis Tests 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!