[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with xlswrite

From: Philip Nienhuis
Subject: Re: Problems with xlswrite
Date: Sat, 12 Nov 2016 03:59:50 -0800 (PST)

dariodematties wrote
> The problem is that, when xlswrite produces the error I posted, the file
> remains intact as it was (if the file was preexistent).
> If there is no preexistent file,  xlswrite does not create any file at
> all.
> It seems that, when the error is produced,  xlswrite does not reach to
> touch the file.

Well that is lucky. That way the file isn't corrupted by faulty writes.

> On the other hand, when there is no error,  xlswrite writes the file or
> creates it.
> Yet, such file can be or not corrupted. (Random behavior).
> If it is corrupted I can do nothing with it...
> Anyway I guess I have to analyze better its behavior in order to report
> the bug well.
> My question: is there an alternative to  xlswrite?

There are several alternatives.
If what you want to write is a rectangular array or cell array you can use
cell2csv (also in the io package); that'll produce a .csv file that can be
read with L.O. directly.

As to xlswrite itself:
If you have Java installed you can use one of the other "interfaces" for
spreadsheet I/O (other than "OCT").
I'd advise jOpendocument then (see Download the
jopendocument-1.4-rc2.jar file, put it somewhere (e.g., in
/home/dario/Downloads/) and add it to the javaclasspath:
javaaddpath ('/home/dario/Downloads/jopendocument-1.4-rc2.jar')
(adapt path if you put the file somewhere else)

Then try again:
xlswrite ('HSTM_Output.ods', sum(H1_CC1_CL4_FiringsUnits), 'H1', 'A7',

Alternatively (again, only if you have Java installed) you can try to invoke
LibreOffice itself using the UNO interface, but you'd have to find out where
LibreOffice is installed. On my Mageia-5 box it is at

The io package contains a utility function to sort things out for you, it's
called chk_spreadsheet_support.m  Invoke it as:

chk_spreadsheet_support ('', 3,

It'll report if Java is usable and if it is, tries to setup the
javaclasspath so that you can use the Java-UNO bridge to invoke LibreOffice
from Octave.
If it all works you can run xlswrite as follows then:

xlswrite ('HSTM_Output.ods', sum(H1_CC1_CL4_FiringsUnits), 'H1', 'A7',

(& ignore the warning about experimental. That warning is valid but what it
warns for isn't usually a problem)


View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]