From: Ulrich on
This is really simple for a fixed number of columns. But, how can one write a simple code when the number of columns is variable?????

"jason" <mcmains.1(a)osu.edu> wrote in message <h3nm1m$icn$1(a)fred.mathworks.com>...
> Hey everyone,
> I'm working on a program that involves cell arrays similar to the following:
>
> Names={'John' 'Smith';'Bob' 'Jones';'Sue' 'Brown'};
>
> and I want to concatenate them like this:
>
> FullName=cell(size(Names,1),1);
> for i=1:length(FullName)
> FullName{i}=[Names{i,1} ' - ' Names{i,2}];
> end
>
> but I'd like to avoid the use of a for loop. Any ideas for optimizing this?
>
> Thanks
> Jason