Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

concatenating cell elements

734 views
Skip to first unread message

Nicolaus

unread,
Dec 10, 2008, 12:07:02 PM12/10/08
to
Help! I am trying to concatenate the elements of two cells in an elegant way; that is, if I have two cells with multiple elements each, I would like the elements of the cells to be available by indexing rather than the cells themselves.
For example, a={1, 2, 3, 4, 5} b={11, 12, 13}
I want c={1, 2, 3, 4, 5, 11, 12, 13} not {a, b}
Is there a quick way to do this?

someone

unread,
Dec 10, 2008, 12:15:04 PM12/10/08
to
"Nicolaus " <nico...@clm.utexas.edu> wrote in message <ghosvm$7vi$1...@fred.mathworks.com>...

% Do you want:
c = [a b]

% Note the square brackets.

Donn Shull

unread,
Dec 10, 2008, 12:16:02 PM12/10/08
to
"Nicolaus " <nico...@clm.utexas.edu> wrote in message <ghosvm$7vi$1...@fred.mathworks.com>...

Hi Nicolaus,

I believe that:

c = {a{:}, b{:}};

is what you are looking for.

Good Luck,

Donn

Nicolaus

unread,
Dec 18, 2008, 2:55:05 PM12/18/08
to
"Donn Shull" <donn.shul...@aetoolbox.com> wrote in message <ghotgi$gjp$1...@fred.mathworks.com>...

Perfect! Thank you both!

0 new messages