From: John on
Howdy!

I'm new to matlab and structures so, please, bear with me. I'm working with data that was collected on multiple channels for multiple tests. I would like to generate a structured array that looks something like this:

legend.Channel(1) = 'Test1'
'Test2'
'Test3'

legend.Channel(2) = 'Test1'
'Test2'
'Test3'

legend.Channel(3) = 'Test1'
'Test2'
'Test3'
..
..
..
legend.Channel(22) = 'Test1'
'Test2'
'Test3'

I'm confused with how to do this. I tried the STRUCT command but got the error "Array dimensions of input 4 must match those of input 2 or be scalar." I understand the error, but I'm looking for some way to do this.

Thanks!
From: Walter Roberson on
John wrote:

> I'm new to matlab and structures so, please, bear with me. I'm working
> with data that was collected on multiple channels for multiple tests. I
> would like to generate a structured array that looks something like this:
>
> legend.Channel(1) = 'Test1'
> 'Test2'
> 'Test3'
>
> legend.Channel(2) = 'Test1'
> 'Test2'
> 'Test3'
>
> legend.Channel(3) = 'Test1'
> 'Test2'
> 'Test3'
> .
> .
> .
> legend.Channel(22) = 'Test1'
> 'Test2'
> 'Test3'

legend = struct('channel',{repmat({{'Test1';'Test2';'Test3'}},22,1)});