Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to save multidimensional MatLab arrays into Excel

325 views
Skip to first unread message

julie KRATZ

unread,
Aug 4, 2009, 9:48:02 AM8/4/09
to

Hello Everybody!

I have created a 3-dimensional array GAIN(z,x,v)=gain.

If I want to display the Gain variable MatLab normally displays it in the following manner:

GAIN(z,x,1)
GAIN(z,x,2)
....
....
GAIN(z,x,vmax)

When I now want to export the different GAIN arrays for v into Excel, I let MatLab display GAIN(z,x,v) in the fashion explained above and copy paste every single GAIN matrix for different values of v into a separate Excel file. As I did not figure out till now how to easily pre-process array data in MatLab to import multidimensional MatLab arrays into separate Excel files for each value of the third dimension.

Now I am dealing with arrays that are too large to be displayed in Matlab, with respect to their row and column number.

How can I import the GAIN arrays for different v values into separate Excel files or other separate spreadsheet files (like SPSS)?

Every single GAIN array for a given value of v is still within the Excel size limit of
65536 rows and 256 columns (i.e. 216 * 28 = 224 (16,777,216) cells).

I would be really glad if one of you could help me with this.

Thank you very much in advance

Julie

Ashish Uthama

unread,
Aug 4, 2009, 1:58:56 PM8/4/09
to
On Tue, 04 Aug 2009 09:48:02 -0400, julie KRATZ <kr...@mpib-berlin.mpg.de>
wrote:


Have you looked at the help for the XLSWRITE function? (I assume you are
on Windows).
If you are on a Mac, you could also look at CSVWRITE which can be read by
MS Excel.

Maybe something like this (air code)

baseFileName='exportedData';
for vInd=1:vmax

%This will create file name like exportedData1.xls, exportedData2.xls
and so on...
fileName=[baseFileName,num2str(vInd),'.xls'];

%A ':' indicates all values along that dimension.
xlswrite(fileName,GAIN(:,:,vInd);

end

Keith Gould

unread,
Aug 4, 2009, 2:46:03 PM8/4/09
to
I've always found xlsread and xlswrite functions to be very stable and useful... Check it out.

TideMan

unread,
Aug 4, 2009, 4:31:24 PM8/4/09
to

The first question one needs to ask is why on earth anyone would
export such huge quantities of data into Excel? I can think of no
good reason for doing this. It reminds me of the days of mainfame
computers and lineprinters when a colleague of mine needed to print
the data (hydro powerstation levels and flows) so that he could look
at them. His desk was surrounded with folders containing lineprinter
output, but he could never find the one he wanted, so he'd have to
print it out again. Madness!

One of the advantages of Matlab is that you can use it to transform
huge quantities of indigestible data into information in the form of
plots, statistics, etc. that are more digestible.

But, if you're fixated on exporting to Excel, then xlswrite is your
friend.

0 new messages