Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Problems with Strings!

$
0
0
On 6/25/2013 4:09 PM, Mary wrote:
> dpb <none@non.net> wrote in message <kqcte3$jk7$1@speranza.aioe.org>...
...

>> I've never used xlswrite() so no help there, really, sorry...
>>
>> I note the following on the "Data to write" expansion...
>>
>> > to write, specified as a two-dimensional numeric or character
>> > array, or, if each cell contains a single element, a cell array.
>> >
>> > If A is a cell array containing something other than a scalar numeric
>> > or a string, then xlswrite silently leaves the corresponding cell in
>> > the spreadsheet empty.
>>
>> Don't know if that's related to your problems/troubles/symptoms or
>> not, but is suggestive methinks...
...

> Thank you so much - I'll give these suggestions a try!
> About the xlswrite it just seems crazy to me that it fills in the
> username information which is a string on sheet 1, but it wont fill
> strings in on sheet 2.
> BTW - I feel like you've answered a billion of my questions on here, and
> I just wanted to say a sincere thank you. You have really made my
> journey of understanding MATLAB enjoyable :)

Not a problem...cs-sm is one of the newsgroups I follow to keep in hand
a little post-retirement from technical side (am now back on family farm)...

Anyway, I played w/ the xlswrite() function just a little -- looks to me
like it works for cell arrays. The following works here w/ 2012b and
old Excel...can't speak of new release.

 >> a={'Name1';'Name2';'Name3'}
a =
     'Name1'
     'Name2'
     'Name3'
 >> xlswrite('xlswr.xls',a{1},1,'A1') % a character per cell
 >> xlswrite('xlswr.xls',a(1),1,'A1') % string in A1
 >> xlswrite('xlswr.xls',a,1,'A1') % the three in A1:A3
 >> a'
ans =
     'Name1' 'Name2' 'Name3'
 >> xlswrite('xlswr.xls',a',1,'A1') % the three in A1:C1
 >>

Look at the example in

help xlswrite

it writes mixed data w/ the header row and array as one would expect/like...

Looks like w/o reading your code more thoroughly you've got a problem w/
the way you're trying to store/write the spreadsheet data.

--

--

Viewing all articles
Browse latest Browse all 19628

Trending Articles