[Top][All Lists]

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

Re: Save Plot in Excel

From: Kwan Lowe
Subject: Re: Save Plot in Excel
Date: Fri, 3 Jul 2020 09:08:33 -0400

> 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.

Here's a quick hack with a Python script... There may be a cleaner
octave way with one of the Excel modules.

    #!/usr/bin/env python
    import sys
    import xlsxwriter
    image_name = sys.argv[1]
    excel_file = sys.argv[2]
    workbook = xlsxwriter.Workbook(excel_file)
    worksheet = workbook.add_worksheet()
    worksheet.set_column('A:A', 20)
    worksheet.insert_image('A1', image_name)

    image_file = 'test.png'
    excel_file = 'out.xlsx'
    out = figure()
    x = -10:0.1:10;
    plot (sin(x));
    print(out, image_file)
    command = [ "./", " ",  image_file, " ", excel_file ]

"Don't be lazy. Do the thing. Do it properly."  - Simone Giertz

reply via email to

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