Check Existence of String
Show older comments
I have a data as follows: This is the sampled data order from serial port which going to come using fgets(): line by line
% date:2016-08-05, time:10:05:23, t1:82.55,h1:85.60,t2:62.55,h2:65.60,
% date:2016-08-05, time:10:05:24, p1:20,p2:35,
% date:2016-08-05, time:10:05:25, p1:35,p2:21,
% date:2016-08-05, time:10:05:26, t1:45,h1:65.60,t2:75.55,h2:65.60,
rdstr='date:2016-08-05,time:10:05:23,t1:82.55,h1:85.60,t2:62.55,h2:65.60,'
Now, I would like to get the data to matrix var1 and var2.
var1= [datetime t1 t2;
datetime t1 t2]...
var2= [datetime h1 h2;
datetime h1 h2]
var3= [datetime p1 p2;
datetime p1 p2]...
Note: The readstr is a serial data received reading one line at a time. the var1 datetime must be at their particular sampling times.
6 Comments
Geoff Hayes
on 13 Mar 2016
Mahesh - what is the data type for readstr? Is it a char or cell? Is it an array of strings or a single string? How do parse each element or have you yet to do that?
Mahesh
on 13 Mar 2016
Geoff Hayes
on 13 Mar 2016
Mahesh - you have changed the format of your string and have removed the "rules" that you had before when creating/updating the other variables. Please clarify what the new algorithm is.
Mahesh
on 13 Mar 2016
Geoff Hayes
on 13 Mar 2016
Mahesh - Please clarify what the new algorithm is. Use an example if necessary.
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings 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!