xlswrite text with multiple empty cells inbetween

2 ビュー (過去 30 日間)
Christian  Egolf
Christian Egolf 2018 年 6 月 22 日
コメント済み: Christian Egolf 2018 年 6 月 22 日
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);

採用された回答

Steven Yeh
Steven Yeh 2018 年 6 月 22 日
編集済み: Steven Yeh 2018 年 6 月 22 日
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'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by