Create Timetable correspond to another timetable
Show older comments
Hi, I am trying to create a timetable that correspond to another timetable data that was generated from CAN data.
For example, I have this timetable with 3 variables and different data.
Reading1 = [0; 0; 3; 3; 2; 0];
Reading2 = [0; 0; 1; 1; 1; 0];
Reading3 = [0; 2; 1; 1; 2; 0];
T = table(Reading1,Reading2, Reading3);
Time = seconds(1:1:6);
TT = table2timetable(T,RowTimes=Time)
Then I would like to create another timetable that has string info for each data that may look like this.
Reading1 = ["Unit Off"; "Unit Off"; "Lock On"; "Lock On"; "Lock Off"; "Unit Off"];
Reading2 = ["Engine Off"; "Engine Off"; "Engine On"; "Engine On"; "Engine On"; "Engine Off"];
Reading3 = ["Hydralic On"; "Hydralic Pressed"; "Hydralic Off"; "Hydralic Off"; "Hydralic Pressed"; "Hydralic On"];
T = table(Reading1,Reading2, Reading3);
Time = seconds(1:1:6);
TT = table2timetable(T,RowTimes=Time)
I believe there is a way to make this work for each varible. Would it be easier if I create a table that contains all of the string infomation and somehow the timetable can refer to it by using for loop? Not sure how that would work.
Ps. I am trying to use the app designer so I believe that some of the code may not work the same. I may have some additional question regard to it.
1 Comment
Dyuman Joshi
on 18 Jan 2024
You can define strings corresponding to each column and then use indexing to obtain the desired table.
Accepted Answer
More Answers (0)
Categories
Find more on Timetables 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!