help-octave
[Top][All Lists]
Advanced

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

Re: Save Plot in Excel


From: PhilipNienhuis
Subject: Re: Save Plot in Excel
Date: Sat, 4 Jul 2020 14:36:27 -0500 (CDT)

Anh Quân Trần Hùng wrote
> Dear administrators of octave,
> I have a question about output data of octave. I want to export plot
> images
> from octave to Microsoft Excel but I haven't found a function to help me.
> 
> Is there any way for me to do that?

First of all the xlsread / xlswrite functions in the io package are intended
for data I/O only. Anything beyond that, e.g., formatting and embedding
graphs etc., is not supported.
As io package maintainer I'm not enthusiastic to include such functionality
in the functions, as it would greatly increase the maintenance burden for
just a few use cases; in addition Matlab has started to advise using Table
I/O for spreadsheet I/O so additional investment in xlsread / xlswrite seems
a bad idea.

That said, I can help getting you started but you'll have to find the way
largely yourself. Maybe there are examples Out There, e.g. on Stackoverflow
or Matlab Central.
Generally it is wise to use higher-level functions to adapt the spreadsheet
file rather than building it manually yourself.

The easiest is probably using Excel itself using the COM spreadsheet I/O
interface, just load the windows package to get that. Once you've opened the
excel file using the xlsopen function, the references to the COM object
representing the spreadsheet are in the output struct. From there on it's
just invoking Visual Basic.
Some guidance is in Excel itself. Open a spreadsheet, click on "Developer"
then '"Visual Basic". Once there you can click on "Help" or tap the F2 key
to get the object browser. There you should find enough info to get further.

An intermediate way is to use one of the Java-based interfaces. From those,
Apache POI is probably the best choice. The Javadocs are online. I'm sure
you can find examples on how to get together what you want.

The hardest way is to try to build the archive yourself. The OCT interface
supplies similar pointers in the output struct returned by xlsopen, but from
experience I know it is a big puzzle to get the various references and
cross-references in the xml files in the archive set up correctly.
Hint: I found that LibreOffice is usually much more verbose as regards
internal file errors while reading than Excel.

Hopefully this helps a little.
Good luck,

Philip




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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