MATLAB Answers

0

How to write Multiple data to Excel

Daniel Boateng さんによって質問されました 2019 年 6 月 13 日
最新アクティビティ dpb
さんによって 編集されました 2019 年 6 月 14 日
Please how can i write multiple data to excel file. I used xlswrite for
filename = 'testdata.xlsx';
A = [12.7;5.02;-98;63.9;0;-.2;56];
xlswrite(filename,A)
and it worked.
But when I add B it generates an error
filename = 'testdata.xlsx';
A = [12.7;5.02;-98;63.9;0;-.2;56];
B= [1 2 3 4 5 6 7];
xlswrite(filename,A,B)
How can I do this please?

  0 件のコメント

サインイン to comment.

タグ

1 件の回答

dpb
回答者: dpb
2019 年 6 月 13 日
編集済み: dpb
2019 年 6 月 14 日

xlswrite is documented to accept one array for output...you've got two disparate pieces of data to place in the spreadsheet--you'll have to either
  1. call xlswrite twice with each array and a RANGE argument to not overwrite the first with the second, or
  2. create a composite array that contains all the data in the desired locations to be written within that array
We can't tell from the limited info just what you expect result to be...see the doc for details of alternate syntax for sheet and range as well as examples with cell arrays to build composite output arrays that are supported.

  0 件のコメント

サインイン to comment.



Translated by