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

 Réponse acceptée

the cyclist
the cyclist le 3 Jan 2013

0 votes

Guessing you want
if untitled(j,54) ==3;
instead of
if untitled(n,54) ==3;

Plus de réponses (2)

Jan
Jan le 3 Jan 2013

0 votes

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

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by