Export data from cell matrix to excel

2 ビュー (過去 30 日間)
EldaEbrithil
EldaEbrithil 2020 年 6 月 24 日
コメント済み: EldaEbrithil 2020 年 6 月 24 日
Hi
i wanto to export all the cell and their relative values contained in Ysol (it contains numerous cells) to an excel file, how can i do that?
forum2.png are the data in each one cell
forum1.png is the Ysol cell matrix view
I have tried with
xlswrite('datiMachlaminar.xls',YSol{:}(:));
but it gives me error
Regards
  2 件のコメント
Rasul Khan
Rasul Khan 2020 年 6 月 24 日
Can you mention the error?
EldaEbrithil
EldaEbrithil 2020 年 6 月 24 日
Expected one output from a curly brace or dot indexing expression, but there were 364 results.
Error in Secondavariante (line 171)
xlswrite('datiMachlaminar.xls',YSol{:}(:));

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

回答 (1 件)

Aakash Mehta
Aakash Mehta 2020 年 6 月 24 日
Assuming your Ysol is looks like this.
C = {1,2,3;
4,5,6;
7,8,9;
10,11,12;
13,14,15}
You can convert it to excel file by below lines of code.
C=num2cell(cell2mat(C.'));
xlswrite('x.xlsx',C)
  2 件のコメント
EldaEbrithil
EldaEbrithil 2020 年 6 月 24 日
not exactly... the C you wrote is basically the a cell of YSol. YSol is a cell ensemble. I have tried your code:
YSol=num2cell(cell2mat(YSol.'));
xlswrite('datiMachlaminar.xlsx',YSol)
it gives me this error:
Error using cat
Dimensions of arrays being concatenated are not consistent.
Error in cell2mat (line 75)
m{n} = cat(2,c{n,:});
Error in Secondavariante (line 171)
YSol=num2cell(cell2mat(YSol.'));
EldaEbrithil
EldaEbrithil 2020 年 6 月 24 日
Ok solved:
for i=1:length(L)
for j=1:length(Mo1)
theArray(i,j) = {YSol{i,j}(:,3)};
end
end
Arr=cell2mat(theArray);
xlswrite('datiMachlaminar', Arr);
Thi code extrapolate only the third column

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

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by