Excel write data into a cell not working for below condition
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
I have to write excel cell with data.
If i provide the data though some variable directly then its working but if it is derived from some other variables then its not written into excel file.
Below is the code for which i am getting problem.
A is derived from some other souce.variable but it is present in workspace
C = cellstr(A);
C = C(2:3);
A1 = " Test input cell 1";
A2 =" Test input cell 2";
P{1,1}=A1;
P{1,2}=A2;
c = cellstr(P);
% c = cellstr(C'); %IF USE THIS THEN NO DATA IS WRITTEN INTO EXCEL
C1 = strjoin(c);
b11= cellstr(C1)
b12 = cellstr(' Test input cell 1 Test input cell 2')
filename = 'testdata3.xlsx';
xlswrite(filename,b11)
Please guide on this.
Thanks in advance.
댓글 수: 1
dpb
2019년 7월 27일
편집: dpb
2019년 7월 27일
We need to know what A actually is...just that it is present doesn't provide sufficient diagnostic data.
NB: From the documentation for XLSWRITE(),
"If A is a cell array containing something other than a scalar numeric or text, then xlswrite silently leaves the corresponding cell in the spreadsheet empty."
Also note that while you don't use it in the snippet above, your b12 is a single string in one cell, not two labels as it looks like you probably intended...
b12 = cellstr('Test input cell 1','Test input cell 2');
or, more simply written with "the curlies" as
b12={'Test input cell 1','Test input cell 2'};
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!