help-octave
[Top][All Lists]
Advanced

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

Re: Writing strings to excel


From: Przemek Klosowski
Subject: Re: Writing strings to excel
Date: Mon, 26 Jun 2017 17:00:56 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 06/26/2017 02:27 PM, rwensley wrote:
At the end I would like it to create a excel spreadsheet  [...]
status = xlswrite (fn, outArray1, wsh,'A2:B33') 
Strings in Matlab arrays are a little awkward, and don't mix well with numbers; you probably need cell-based data.
Actually, would writing a CSV file work for you? Excel can read CSV format just fine and it's much easier to generate in Octave because it's just strings:

fp=fopen('a.csv','w')
a1=char("a =","bbbb =","c =")
a2 =[1   2   3]
for i=1:3; fprintf(fp,"%s,%f\n",a1(i,:),a2(i));end

giving

a =   ,1.000000
bbbb =,2.000000
c =   ,3.000000


reply via email to

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