[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem using xlswrite
From: |
Kai Torben Ohlhus |
Subject: |
Re: Problem using xlswrite |
Date: |
Wed, 8 Apr 2020 13:45:09 +0900 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
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