help-octave
[Top][All Lists]
Advanced

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

RE: Problem using xlswrite


From: stf.lorenzini
Subject: RE: Problem using xlswrite
Date: Wed, 8 Apr 2020 08:54:49 +0200

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 <address@hidden>
Sent: mercoledì 8 aprile 2020 06:45
To: address@hidden; address@hidden
Subject: Re: Problem using xlswrite

On 4/8/20 8:40 AM, address@hidden 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




reply via email to

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