schwarz
schwarz

Reputation: 521

How to concatenate a struct with an array in matlab?

I would like to create a packet and the data load is an array. For the header I would like to create a struct because it would be easier to index its fields. For transmission, I need to concatenate both the struct and array to create a packet. How can I do it?

Upvotes: 2

Views: 179

Answers (1)

Andrey Rubshtein
Andrey Rubshtein

Reputation: 20915

You should use a cell array:

 a = 1:10;
 b = struct('x',1,'y',2);
 packet = {a, b};

Upvotes: 3

Related Questions