structs: How to add a new DATE field as 3 concatenated fields

structs: How to add a new DATE field as 3 concatenated fields

Post by Kirk » Fri, 05 Dec 2008 06:16:02


I need to add a new DATE field to struct (s) made up of several fields of size 48x1. In addition, the new field needs to be filled with the concatenated values from three of the existing fields.

I have been trying to pull this off with "setfield",


but I can't seem to figure out the concatenate step. I thought I could just put the three concatenated fields in brackets [], like this...

[field1 field2 field3]

???

Any help would be most appreciated.
 
 
 

structs: How to add a new DATE field as 3 concatenated fields

Post by Kirk » Fri, 05 Dec 2008 06:49:02


Latest try:

struct.date={struct.day structa.month struct.year}

Gives me 3 cells filled with 48x1 vectors

year: [48x1 double]
month: [48x1 double]
day: [48x1 double]
doy: [48x1 double]
tmax: [48x1 double]
tmin: [48x1 double]
par: [48x1 double]
prec: [48x1 double]
O3: [48x1 double]
CO2: [48x1 double]
NH4dep: [48x1 double]
NO3dep: [48x1 double]
date: {[48x1 double] [48x1 double] [48x1 double]}