Export a datamatrix from Matlab to excel

Asked

Viewed 5,445 times

1

I have a file with several matrices, as described:

Name          Value
lat           <162x168 single>
lon           <162x168 single>
obsData       <162x168x4929 double>
time          <5844x3 double>
v6Data        <162x168x4929 double>
v7Data        <162x168x4929 double>

I want to send this data to excel or cvs. I tried several commands unsuccessfully. Someone has already done this export?

1 answer

1

Hello

Using Matlab R2015a you can use this command to save 2D arrays:

xlswrite('NomeDoArquivoXLS', matriz);

Some of your matrices have 3D. In this case the matrices can be saved in the same file only in different worksheets. Example:

A = zeros(20, 10, 3); 
for i = 1 : size(A,3),
    A(:,:,i) = A(:,:,i) + i;
    xlswrite('NomeDoArquivoXLS', A(:,:,i), i); 
end

The last parameter of the function xlswrite is the spreadsheet number.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.