Producing strings in empty column based on strings on another column
Mostra commenti meno recenti
I have a spreadsheet with a blank column (57x1) that I want filled out based on the strings on another column (57x1).
Basically
If column 5 contains brad, the corresponding row in column 7 should have brad
If column 5 contains fred, the corresponding row in column 7 should have fred
If column 5 is a contains mike , angie, or alex, the corresponding row in column 7 should have oscar.
If column 5 contains any other name (jack, joe, etc), the corresponding row in column 7 should have roger
Column 5
mike
mike
brad
brad
angie
fred
fred
alex
jack
joe
matt
brad
Column 7 should look like this
oscar
oscar
brad
brad
oscar
fred
fred
oscar
roger
roger
roger
brad
How do I do this ?
1 Commento
Image Analyst
il 18 Giu 2020
Try strcmpi() or contains(). Make it easy for people to help you. Give us your table in a .mat file, or give code to construct it. It will make it easier for people to try things and help you.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Numeric Types in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!