i have excel sheet 31 coulmn,, the first coulmn is time and in the other coulmns the signals names , what i need from the code is that at spefic time to tell me for examplk

1 view (last 30 days)
i have excel sheet 31 coulmn,, the first coulmn is time and in the other coulmns the signals names , what i need from the code is that at spefic time to tell me for example how many ones are there and which samples of the 31 are the one at that time , how to that ?
  4 Comments
Hagar Hendy
Hagar Hendy on 7 Dec 2022
i get that table from another program , and i know the at which time the signal is one, so acording to that , i am choosing that spesfic time, , my concerns is how to know that this signal is one , not only the counting , i want to know the signal name that is 1 out of the 30

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 7 Dec 2022
Edited: Walter Roberson on 7 Dec 2022
Given a particular scalar row index (calculated from the time, perhaps):
VarNames = YourTable.Properties.VariableNames;
ValuesAtIndex = YourTable{RowIndex, 2:end};
match_columns = 1 + find(ValuesAtIndex == 1);
matched_signal_names = VarNames(match_columns);
matched_signal_names will be a cell array of character vectors. It will be empty if there are no matches, and might have multiple entries if there are multiple matches.
  3 Comments
Peter Perkins
Peter Perkins on 12 Dec 2022
In recent versions, if time is involved, use readtimetable. Then use time subscripting on the timetable, and beyond that, I can't tell what the question is.

Sign in to comment.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!