Hi,
I have a code in matlab that generates an big array [3648x1]. This array looks something like:
[NaN
NaN
NaN
NaN
0
0
1
0
1
1
NaN
NaN
NaN
0
0
1
1 ]
I want to replace the zeros with NaN, where after I can delete all the NaN's
This is the code, where variable1 is the [3648x1] array (and a, b, c are also [3648x1] array's);
for a = 0 : (length(variable1)-1);
if variable1(a+1) == 0;
variabele2(a+1) = NaN;
end
end
k = [variabele2, a, b, c];
k(any(isnan(k),2),:)=[];
variabele2 = k(1:end,1);
a = k(1:end,2);
b = k(1:end,3);
c = k(1:end,4);
But after the for loop, the array is reduced to an [1x1656] array. How is this possible? And more important, how can I fix it so the code will do what I want.