フィルターのクリア

Write cell array to excel format with xlswrite

23 ビュー (過去 30 日間)
Wout Depoot
Wout Depoot 2020 年 4 月 5 日
コメント済み: Wout Depoot 2020 年 4 月 5 日
Hello,
I have a cell array AllCoverage containing 4 cell arrays each containing 3 columns and I want to write this out to an excel file.
I tried the following code:
xlswrite('AllCoverage.xls',{'WO_1','WO_2','BL_1','BL_2'};AllCoverage{1},AllCoverage{2},AllCoverage{3},AllCoverage{4});
But i'm getting the following error:
Error: File: Volumes.m Line: 13 Column: 57
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters.
  1 件のコメント
Wout Depoot
Wout Depoot 2020 年 4 月 5 日
Thanks in advance!

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

採用された回答

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020 年 4 月 5 日
You need to check the syntax of xlswrite, then you see that you're calling it with wrong arguments. You have to transform your array in one single cell structure and pass it only that structure to the function. The use of ";" is also wrong, every time you use it you tell matlab that the line/command is over, so using it give you this error. I'm not entirerly sure how you want your data, but an example that could work based in your description is this one:
CellTosave = cell(2,12);
CellTosave{1,1} = 'WO_1';
CellTosave{1,4} = 'WO_2';
CellTosave{1,7} = 'BL_1';
CellTosave{1,10} = 'BL_2';
CellTosave{2,1} = AllCoverage{1};
CellTosave{2,4} = AllCoverage{2};
CellTosave{2,7} = AllCoverage{3};
CellTosave{2,10} = AllCoverage{4};
xlswrite('AllCoverage.xls',CellTosave);
  1 件のコメント
Wout Depoot
Wout Depoot 2020 年 4 月 5 日
Thanks, this worked just fine!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by