Filter löschen
Filter löschen

xlswrite text with multiple empty cells inbetween

1 Ansicht (letzte 30 Tage)
Christian  Egolf
Christian Egolf am 22 Jun. 2018
Kommentiert: Christian Egolf am 22 Jun. 2018
I have ratio data for multiple markets and would like to write them to excel, as the sequence of ratios stays the same I just write the Header2 multiple times. For the top row however there should be, in this case, four empty cells inbetween the market titles. I have another case where I need 20 empty cells inbetween each title. Is there a shorter way to do this?
Ratios = [PB, PE, EVEBITDA, PFCF, ROE];
RatiosD = [PB, PE, EVEBITDA, PFCF, ROE];
RatiosE = [PB, PE, EVEBITDA, PFCF, ROE];
Header1 = {'All,'','','','' 'Developed','','','','' 'Emerging'};
Header2 = {'PB', 'PE', 'EVEBITDA', 'PFCF', 'ROE'};
xlswrite('Ratios.xlsx', [Header1], 'Ratios', A1);
xlswrite('Ratios.xlsx', [Header2, Header2, Header2], 'Ratios', A2);
xlswrite('Ratios.xlsx', [Ratios, RatiosD, RatiosE], 'Ratios', A3);

Akzeptierte Antwort

Steven Yeh
Steven Yeh am 22 Jun. 2018
Bearbeitet: Steven Yeh am 22 Jun. 2018
There are many ways to do this, one of them is to create padding cells:
a = cell(1,20);
Header1 = {'All',a{:}, 'Developed','','','','' 'Emerging'}
Or you could expand the cells by indexing:
Header1{1} = 'All'
Header1{21} = 'Developed'
Header1{41} = 'Emerging'

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by