I have table like this:
t = {False, False, False, 4.5, 6.789, 1.23, 0.98, False, False}
and I want to know how many False values I have at the beginning and at the end of the table.
I made:
size = Length[t]
t = Cases[t,Except[False]];
size2 = Length[t]
diff = size - size2
But this counts number of all 'False'
values inside the table. But I want to know how many is at the beginning and how many at the end (so i my example I have: 3 at the beginning and 2 at the end). How can I solve that?
False
, what you want, the length of the lsit or the numbers at the beginning and at the end separately? (It's an edge-case in which the numbers ofFalse
and from the beginning and from the end are each equal to the length of the list. Based on your example, I would assume in the case of allFalse
you want the length and otherwise the sum of the runs. But please clarify.) $\endgroup$