Problem using xlswrite

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem using xlswrite

stf.lorenzini

Hi,

 

I have Octave 5.2.0. I need to export data in xls format.

 

I have this test code:

 

octave:1> pkg load io

octave:2> pkg load windows

octave:3> B=['ID1';'ID2';'ID3'];

octave:4> xlswrite('prova.xlsx', B, 'provatab')

warning:  No Java support found (no Java JRE? no Java pkg installed AND loaded?)

warning: called from

    getinterfaces at line 121 column 11

    xlsopen at line 299 column 14

    xlswrite at line 223 column 9

(oct2xls: input character array converted to 1x1 cell)

ans =  1

 

Opening the exported prova.xlsx file I see only the string “ID1” in the most top left cell (A1) and nothing else. The intention would be to export ID1, ID2 and ID2 respectively in A1, A2 and A3 cells.

 

Any help?

 

Thanks so much

Stefano

 


Mail priva di virus. www.avast.com


Reply | Threaded
Open this post in threaded view
|

Re: Problem using xlswrite

siko1056
On 4/8/20 8:40 AM, [hidden email] wrote:

> Hi,
>
> I have Octave 5.2.0. I need to export data in xls format.
>
> I have this test code:
>
> octave:1> pkg load io
> octave:2> pkg load windows
> octave:3> B=['ID1';'ID2';'ID3'];
> octave:4> xlswrite('prova.xlsx', B, 'provatab')
> warning:  No Java support found (no Java JRE? no Java pkg installed AND
> loaded?)
>
> warning: called from
>     getinterfaces at line 121 column 11
>     xlsopen at line 299 column 14
>     xlswrite at line 223 column 9
> (oct2xls: input character array converted to 1x1 cell)
> ans =  1
>
> Opening the exported prova.xlsx file I see only the string “ID1” in the
> most top left cell (A1) and nothing else. The intention would be to
> export ID1, ID2 and ID2 respectively in A1, A2 and A3 cells.
>
> Any help?
>
> Thanks so much
> Stefano


Dear Stefano,

Running your example, I see "IIIDDD123" in (A1).  You should use cellstr
/ cell arrays for spreadsheet export of text, as the manual states [1].

  "arr can be any 1D or 2D array containing numerical, logical and/or
   character data (cellstr) except complex. Mixed numeric/text arrays
   can only be cell arrays.."

The replace in your code:

  B = {'ID1';'ID2';'ID3'};

HTH,
Kai


[1] https://octave.sourceforge.io/io/function/xlswrite.html


Reply | Threaded
Open this post in threaded view
|

RE: Problem using xlswrite

stf.lorenzini
Dear Kai,

Thank you very much for your prompt answer and to teach me this technique. I'm new in Octave, so still a lot to learn ...

Thanks
-Stefano


-----Original Message-----
From: Kai Torben Ohlhus <[hidden email]>
Sent: mercoledì 8 aprile 2020 06:45
To: [hidden email]; [hidden email]
Subject: Re: Problem using xlswrite

On 4/8/20 8:40 AM, [hidden email] wrote:

> Hi,
>
> I have Octave 5.2.0. I need to export data in xls format.
>
> I have this test code:
>
> octave:1> pkg load io
> octave:2> pkg load windows
> octave:3> B=['ID1';'ID2';'ID3'];
> octave:4> xlswrite('prova.xlsx', B, 'provatab')
> warning:  No Java support found (no Java JRE? no Java pkg installed
> AND
> loaded?)
>
> warning: called from
>     getinterfaces at line 121 column 11
>     xlsopen at line 299 column 14
>     xlswrite at line 223 column 9
> (oct2xls: input character array converted to 1x1 cell) ans =  1
>
> Opening the exported prova.xlsx file I see only the string “ID1” in
> the most top left cell (A1) and nothing else. The intention would be
> to export ID1, ID2 and ID2 respectively in A1, A2 and A3 cells.
>
> Any help?
>
> Thanks so much
> Stefano


Dear Stefano,

Running your example, I see "IIIDDD123" in (A1).  You should use cellstr / cell arrays for spreadsheet export of text, as the manual states [1].

  "arr can be any 1D or 2D array containing numerical, logical and/or
   character data (cellstr) except complex. Mixed numeric/text arrays
   can only be cell arrays.."

The replace in your code:

  B = {'ID1';'ID2';'ID3'};

HTH,
Kai


[1] https://octave.sourceforge.io/io/function/xlswrite.html


--
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus