Extract changes on a string
Show older comments
Hello everyone,
I am trying to come up with a solution for the following:
I have two vars with the same size: "status" and "dates". "status" refers to different status on an equipment, and I need only the cells where a change in status occurs. Let me illustrate
'Online' %01
'Online' %02
'Online' %03
'Online' %04
'Online' %05
'Online' %06
'Offline' %07
'Offline' %08
'Offline' %09
'Offline' %10
'Offline' %11
'Offline' %12
I need to extract from a list like this only lines like 06 and 07, which is the last entry of one status and the first entry of the other. However, it's not just that. I also have the "dates" on datetime, and they all correspond with each cell on "status". So in order to preserve the date information of each cell, I need to, in this example, get the information on lines 06 and 07 of the "status" list and also the date on lines 06 and 07 of the "dates" list.
I have no idea of where to begin with this code :(
I hope I explained everything as clearly as possible. I'm sending the referred lists as an attachment for better understanding.
Thanks in advance,
Arthur.
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!