Create single array from multiple arrays in struct
4 views (last 30 days)
HI, I am rather new to Matlab and am trying to perform some statistics on data I have in a structure. I have several hundred arrays of varying length for each index in the structure representing water levels from a storm (Storm.hydrograph). I want to be able to get the mean and standard deviation for all of the values from all storms. To do this, I am trying to generate a single list/array of all the water level points from every storm.
I have tried :
allHydro = [Storms.hydrograph]
but I get error messages because each of the arrays are of unique length.
Is there a way to get them all in one array? Or is there a way to perform statistics on them as they are in the structure? (I have already done statistics on them individually, but want statistics of all the values combined).
cr on 14 Dec 2021
Presuming the error you got is "Dimensions of arrays being concatenated are not consistent.", all data in column vectors may be concatenated using
allHydro = cat(1,Storms.hydrograph);