Adding a new column in table based on matching number from other columns in the same table
Show older comments
Hi,
I am trying to create an additional column of 'choice', which should contain either 'air,'trian','bus', 'car' depending upon where 1 has appeared in their respective column for given row.
I am unable to write the code that searches for 1 in columns in AIR, Train, Bus, Car and append the name of the column (e.g., car in first row) to new column named as 'choice'.
Any help would be highly appreciated.
Best wishes,
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!