xlswrite text with multiple empty cells inbetween

5 visualizzazioni (ultimi 30 giorni)
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);

Risposta accettata

Steven Yeh
Steven Yeh il 22 Giu 2018
Modificato: Steven Yeh il 22 Giu 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'

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by