Separating Data into columns based on certain text variable in that data
Afficher commentaires plus anciens
I have a list of daily stock returns for each stock on the S&P 500. The returns are formatted so that each stock is grouped together like this:
1/1/2013 AAPL .005%
1/2/2013 AAPL -.1%
....
1/1/2013 GOOG .5%
1/2/2013 GOOG .25%
How would I sort this so that the each stock can be a column name and have its returns below it?
Thanks!
1 commentaire
Bob Thompson
le 2 Avr 2018
Is the string setup such that there is a space between the letters and the trailing percentage? If so, you could split the string at the two spaces using one of a couple of different commands (I can't think of what exactly they are off the top of my head, something like strsplit() and regexp()), and then use sorting or indexing based on the middle string which has your specific letter code.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!