Suppose there is a struct scalar, each field of which contains a numeric array of the same size. I would like to convert it into a struct array of the same size as the individual fields of the struct scalar, and convert it back to the original struct scalar. I wrote a short script on my own with some exemplary data, as follows:
But I think with a sufficiently large number of fields, this method would become infeasible, and also I would try to bypass the use of for-loop as much as I could. So I wonder if there are any better ways that achieve the same goal. Thanks a lot!