Converts from a structure, where each field contains an Nx1 array, into an 1xN array of structures, where each field contains 1 value.
I decided to create and share this after not finding a readily available answer on the internet; though I suspect SOMEONE out there has already solved this issue.
S = structofarrays2arrayofstructs(A) assumes that A is a struct, with each field
containing Nx1 (columns) of values. (theoretically NxM values, where M may vary). This results in an Nx1 array of
structs, each containing 1 (or M) values.
>> S = structofarrays2arrayofstructs(A)
1x3 struct array with fields:
Note, Any cells it encounters are unwrapped.
In a test, with 6 fields, each with 377670x1 values (mixed, Cells of chars and arrays of Double), it took ~20 seconds to convert.