help-octave
[Top][All Lists]
Advanced

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

Re: Writing strings to excel


From: Philip Nienhuis
Subject: Re: Writing strings to excel
Date: Mon, 26 Jun 2017 13:24:38 -0700 (PDT)

rwensley wrote
> Greetings,
> I have a script that generates a report for a particular test run.
> At the end I would like it to create a excel spreadsheet for that
> particular test.
> The first column A2:A33 is to contain the variable name ie. "Test =",
> "Tester =", etc.
> in octave I set up the array as 
> outArray1=char("tester =","testing =","tested =") 
> NOTE: I have also tried
> outArray1=[tester =","testing =","tested ="]
> 
> After setting the filename fn and the worksheet name wsh I enter the
> following
> 
> status = xlswrite (fn, outArray1, wsh,'A2:B33') 
> with the hope of populating column A with the variable names.
> 
> When executed octave returns with
> warning: xlswrite - array truncated to 5 by 2 to fit in range A2:B6
> (oct2xls: input character array converted to 1x1 cell)
> status =  1
> 
> And in Excel at cell A2 I have a t.  Just the t and nothing else.
> 
> I am sure I am missing something here and any help will be appreciated.

Both

outArray1=char("tester =","testing =","tested =") 
   &
outArray1=[tester =","testing =","tested ="]

will give you a character array.

I think what you need is a cell array:

outArray1={"tester =";"testing =";"tested ="}  ## Note: semicolons to make
it a 3x1 rather than 1x3 array

If I try that (with your xlswrite command) I get a spreadsheet with 

tester =
testing =
tested =

in cells A2:A4.

xlswrite.m's (or rather oct2xls.m's) complaints about the sizes and ranges
are intriguing. I'll look into that.

BTW what io package version and Octave version do you use?
Try:

ver

at the command prompt, it'll echo a listing of Octave version and versions
of all installed packages (I only need Octave and io package versions)

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Writing-strings-to-excel-tp4683922p4683924.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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