How can I create a string vector?
Mostrar comentarios más antiguos
Given a vector containing a certain number of elements, for example vector=[2,4,3], I have to create a vector containing in each row (or column) the name of the corresponding planet in the solar system. In the case of the previous vector, the result should be PlanetName=['Venus';'Mars';'Earth']. Can you suggest me a method to create such a vector? thank you.
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 27 de Dic. de 2015
You can use cell arrays, for example:
planet={'planet1' 'planet2' 'planet3' 'planet4'}
vector=[2,4,3]
our=planet(vector)
Categorías
Más información sobre Earth and Planetary Science en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!