Write nested cell array data into separate excel sheets

5 ビュー (過去 30 日間)
Ganesh Naik
Ganesh Naik 2022 年 3 月 18 日
コメント済み: Arif Hoq 2022 年 3 月 18 日
Hi all,
I have a nested array data (5 rows and 7 columns) and would like to save the results of each row onto separate excel sheets. In my case, I have 5 rows of nested cell data where I would like to have 5 excel sheets with sheet names representing the ID of the user.
Any help in this is highly appreciated. I have attached the data.

採用された回答

Arif Hoq
Arif Hoq 2022 年 3 月 18 日
編集済み: Arif Hoq 2022 年 3 月 18 日
try this:
A=load('Data3.mat');
B=A.Tc ;
firstrow=[B{1,:}];
% C=string(firstrow);
writecell(firstrow,'filename1.xlsx')
secrow=[B{2,:}];
writecell(secrow,'filename2.xlsx')
thirdrow=[B{3,:}];
writecell(thirdrow,'filename3.xlsx')
upto row 5....
  3 件のコメント
Ganesh Naik
Ganesh Naik 2022 年 3 月 18 日
I have figured out the answer. I am posting the detailed answer, Hope it is helpful to others.
If "Tc" is the nested cell array (refer to the Figure) then the following code creates separate Excel files for each nested row.
for i=1:numel(Tc(:,1))
Row= [Tc{i,:}]
writecell(Row,['filename' num2str(i) '.xlsx'])
end
Arif Hoq
Arif Hoq 2022 年 3 月 18 日
great job..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by