help-octave
[Top][All Lists]
Advanced

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

string concatenation problem


From: Michael Grossbach
Subject: string concatenation problem
Date: Thu, 19 Mar 2009 13:54:25 +0100
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

On Octave 3.0.1 on Linux I have a cell array of strings:

>entirefile
entirefile =

{
  [1,1] = ,1,Picture,cue,144,0,1,60038,2,0,next
  [2,1] = ,1,Response,137,60147,60003,3
  [3,1] = ,2,Picture,fix,60182,0,1,20123,2,0,20500
  [4,1] = ,3,Picture,fix,85793,5500,2,11309,4,5500,next
  [5,1] = ,3,Sound,131,85795,5502,3,,,5500
  .
  .
  .
}

Accessing lines works as expected:

>entirefile{1}
ans = ,1,Picture,cue,144,0,1,60038,2,0,next

Appending a character to a line does not work:
>a = strcat(entirefile{1}, ',')
,
Interestingly, the result of strcat() is not returned in the variable ans as usual.

Assigning entirefile{1} to a new variable does not change the behaviour:
>test = entirefile{1};
>strcat(test, ',')
,
>whos entirefile test

*** local user variables:

  Prot Name            Size                     Bytes  Class
  ==== ====            ====                     =====  =====
   rwd entirefile    508x1                      21745  cell
   rwd test            1x38                        38  char

Total is 546 elements using 21783 bytes

Appending an empty string returns the expected result though:
>strcat(entirefile{1}, '')
ans = ,1,Picture,cue,144,0,1,60038,2,0,next

What am I doing wrong here?

Michael


reply via email to

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