transform data from rows to columns

1 Ansicht (letzte 30 Tage)
Myurathan Kajendran
Myurathan Kajendran am 21 Jun. 2016
I have a CSV data file. That looks like below company-----Date--------Price ComA--------15/05/2015--20.5 ComA--------15/06/2015--30 Comb--------15/05/2015--15
I want the companies to be in the columns and dates to be rows. How to do that?

Akzeptierte Antwort

Shameer Parmar
Shameer Parmar am 21 Jun. 2016
If you have variable 'data' like..
data = {'company-----Date--------Price', 'ComA--------15/05/2015--20.5', 'ComA--------15/06/2015--30', 'Comb--------15/05/2015--15'}
then
following command give you the expected result in column..
data = data';
output will be as follows:
data =
'company-----Date--------Price'
'ComA--------15/05/2015--20.5'
'ComA--------15/06/2015--30'
'Comb--------15/05/2015--15'
  1 Kommentar
Myurathan Kajendran
Myurathan Kajendran am 21 Jun. 2016
Thank you so much for your quick reply. I will try and get back. Thanks again

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Portfolio Optimization and Asset Allocation finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by