Why doesn't xlswrite work properly for this code

조회 수: 2 (최근 30일)
Injectors
Injectors 2011년 10월 13일
output_data = {t,y,A};
xlswrite('testdata_output.xlsx',output_data)
Variables
t = 500 * 1 Matrix
y = 500 * 1 Matrix
A = [0.997250595282513;4.028650036049457;4.966927941572196]
For some reason when I run it does not display anything in the excel file. Could someone help me fix it. Thanks
  댓글 수: 1
Jan
Jan 2011년 10월 13일
At leat I get an error message, when I try to run XLSWRITE with this cell as input.

댓글을 달려면 로그인하십시오.

채택된 답변

Artik Crazy
Artik Crazy 2011년 10월 13일
From xlswrite help:
xlswrite(filename,A)
Input Arguments:
A
Two-dimensional numeric or character array or, if each cell contains a single element, a cell array.
For example xlswrite('testdata_output.xlsx',{t}) won't work as well, because the cell contains a 500x1 matrix and not a single element.
xlswrite('testdata_output.xlsx',{1}) works good.
Try this instead:
xlswrite ('testdata_output.xlsx', [t y], 1, 'A1');
xlswrite ('testdata_output.xlsx', A, 1, 'C1');
  댓글 수: 1
Injectors
Injectors 2011년 10월 13일
This works great! Thanks for your help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by