conditional representation of logical numbers
Show older comments
Hello
Please I have the following time series { 111110011111000000011000011111} in time interval of seconds.
I want to use the following conditions on the sequence. Assuming 1 = True and 0 = false
if false is < 3 seconds and are inbetween two "true periods" then it is translated as 1
if true is < 3 seconds they are translated into 0
The answer when the condition is applied is
11111111111100000000000011111
I will be grateful if anyone assist me in writing this code
Thanks in advance
4 Comments
Walter Roberson
on 3 Jun 2021
Original, with counts
111110011111000000011000011111
5 2 5 7 2 4 5
Revised, with counts
11111111111100000000000011111
C C 5
where C = 12
In the original, the first groups have 5+2+5 = 12, and that is translated into 12 1's in the output.
In the original, the middle groups have 7+2+4 = 13, and that is translated into 12 0's in the output.
So the two 0's was translated into 2 1's for the first group, but the two 1's were translated to 1 0's for the second group.
However, your instructions seem to be symmetric about the translation. We cannot tell from your instructions whether you intend each of the false to be translated into individual 1's, or if you intend the stretch of 0 or 1 false to be translated into single 1, but we can expect you to be consistent about it... but you were not. The 0's each got translated to 1, but the stretch of 1's got translated to a single 0.
Tino
on 4 Jun 2021
Walter Roberson
on 4 Jun 2021
But is 11100111 to be translated to 1111111 (the run is converted to a single 1), or is 11100111 to be translated to 11111111 (each 0 is to be translated to a 1) ? Your example result used both possibilities.
Tino
on 4 Jun 2021
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!