Exporting a 50 by 50 Matrix to excel

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 Comment

Okey I found how to do it
xlswrite('filename.xls',Matrix)

Sign in to comment.

Answers (2)

the cyclist
the cyclist on 14 Dec 2011
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 Comments

So Should it be something like
Matrix = xlswrite()
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.

Sign in to comment.

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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Tags

Asked:

on 14 Dec 2011

Community Treasure Hunt

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

Start Hunting!