Exporting a 50 by 50 Matrix to excel

조회 수: 3 (최근 30일)
Pourya saber
Pourya saber 2011년 12월 14일
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 ?
  댓글 수: 1
Pourya saber
Pourya saber 2011년 12월 14일
Okey I found how to do it
xlswrite('filename.xls',Matrix)

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

답변 (2개)

the cyclist
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
Pourya saber
Pourya saber 2011년 12월 14일
So Should it be something like
Matrix = xlswrite()
Image Analyst
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
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

카테고리

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