Exporting a 50 by 50 Matrix to excel
1 次查看(过去 30 天)
显示 更早的评论
hello I was wondering How I can Export a 50x50 matrix to excel.
I found that I can use xlswrite, but I have to assign a range, which is kind of confusing, Because I have to specify the range.
Is there a way I can just give the matrix as an input argument and get the matrix, without specifying the range ?
回答(2 个)
the cyclist
2011-12-14
The range is an optional argument to xlswrite(). It will just start at A1 if you don't specify the range.
You can also just specify the first cell of the range, and the extent will be determined by the size of the matrix.
2 个评论
Image Analyst
2011-12-14
No. If you would look in the help you'll see how to do it plus this example:
Write mixed text and numeric data to testdata2.xls, starting at cell E1 of Sheet1:
d = {'Time','Temperature'; 12,98; 13,99; 14,97};
xlswrite('testdata2.xls', d, 1, 'E1')
d could be a numerical matrix instead of a cell array and it would still work.
Aldin
2011-12-15
Here is the code of your problem:
if you have : mat = [ 1 2 3; 4 5 6; 7 8 9 ; 10 11 12 13];
leng = length(mat); % leng = 4
for i = 1:leng
var = ['A',num2str(i)];
xlswrite('data.xls',x(i,:),1,var);
end
Thats it
x(1,:) ----> 1 2 3 x(2,:) ----> 4 5 6 x(3,:) ----> 7 8 9 with for loop and so on...
var ---> A1,A2,A3.... with for loop
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!