help-octave
[Top][All Lists]
Advanced

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

Re: Appending to a cell string array


From: Judd Storrs
Subject: Re: Appending to a cell string array
Date: Wed, 9 Feb 2011 11:44:35 -0500

2011/2/9 Jordi Gutiérrez Hermoso <address@hidden>
Suppose I have two cell string arrays, x and y, and the strings in x
and y may be of differing lengths. How can I get a larger array z with
a linear index from 1 to length(x)+length(y)? I don't want the cell
arrays to nest.

Oh, and no loops, but that goes without saying. ;-)

I'm not sure I understand your question, but...

octave:1> x{1} = "Hello" ;
octave:2> x{2} = "foo" ;
octave:3> y{1} = "World" ;
octave:4> y{2} = "!" ;
octave:5> y{3} = "bar" ;
octave:6> z = {x{:} y{:}}
z =

{
  [1,1] = Hello
  [1,2] = foo
  [1,3] = World
  [1,4] = !
  [1,5] = bar
}


--judd

reply via email to

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