Effacer les filtres
Effacer les filtres

xlswrite text with multiple empty cells inbetween

1 vue (au cours des 30 derniers jours)
Christian  Egolf
Christian Egolf le 22 Juin 2018
Commenté : Christian Egolf le 22 Juin 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);

Réponse acceptée

Steven Yeh
Steven Yeh le 22 Juin 2018
Modifié(e) : Steven Yeh le 22 Juin 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'

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by