필터 지우기
필터 지우기

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.

채택된 답변

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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by