How to print information based on ids in another column?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a list of ids in one column and color in the 2nd column. how do i print information based on the id. if you scan through the entire id and if apple is a match it should print out red in the column next to it. The final output should be this
- apple red
- apple red
- banana yellow
- apple red
- pear green
- banana yellow
- pear green
0 comentarios
Respuestas (1)
Star Strider
el 14 de Mayo de 2014
Not really certain what you want, but this should get you started:
C = [{'banana'} {'yellow'};
{'apple'} {'red'};
{'pear'} {'green'}];
Q = C{strcmp(C, 'apple'), 2}
2 comentarios
Star Strider
el 14 de Mayo de 2014
You have a 1-row by 821-column vector by your description.
The impression I got from your question is that you have a matrix and are getting the information on some of the elements in the rows that matched the information in the first column.
Ver también
Categorías
Más información sobre Desktop en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!