Exporting a 50 by 50 Matrix to excel

3 Ansichten (letzte 30 Tage)
Pourya saber
Pourya saber am 14 Dez. 2011
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 Kommentar
Pourya saber
Pourya saber am 14 Dez. 2011
Okey I found how to do it
xlswrite('filename.xls',Matrix)

Melden Sie sich an, um zu kommentieren.

Antworten (2)

the cyclist
the cyclist am 14 Dez. 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 Kommentare
Pourya saber
Pourya saber am 14 Dez. 2011
So Should it be something like
Matrix = xlswrite()
Image Analyst
Image Analyst am 14 Dez. 2011
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.

Melden Sie sich an, um zu kommentieren.


Aldin
Aldin am 15 Dez. 2011
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

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by