> It sounds preferable to use a 10xN matrix where N is the number of sampling times to record the data and put it in NaN at hours where a particular bus is not working. Not only is this much easier to index/access, but notice also that that would ensure that your samples are always synchronized if a bus breaks for some period of samples and then starts working again. That's much harder to do if you simply don't record the activity of broken buses. ===================================================
Thanks for your help. It looks like it is better to change the whole data structure to make it easier and faster the recording process. But it would be nice to have this functionality to simultenously record a data to structure array like the way I was trying to implement. Because in my real case I have thousands of buses and tens of fields to fill in data, over time as the matrices become huge the memory fails to process that data.