MATLAB: Setting up a nested data structure

nested structuressortingstructure

I have a large data set containing a 300×1 matrix of various male heights and another 300×1 matrix of female heights. I sorted these heights manually using a selection sort algorithm and also using matlab's sort() command. I then timed the manual and matlab excecutions using the tic/toc commands. Basically I need to create a nested strucure that includes the sorted male and female heights as well as the manual and matlab run times for each gender. the included image details what needs to be stored into what
How do I put the manual and matlab data into the appropriate gender (female or male)? here is the code I used (its very wrong)
(female=300×1 height matrix
male=height matrix)
SortedHeights=struct('Female Heights',female,struct('Manual',manual_time,'Matlab',matlab_female),'Male Heights',male,struct('Manual',manual_time,'Matlab',matlab_male))
i apologize if any of my wording is confusing lol

Best Answer

Your information architecture diagram doesn't look quite right. For example, your [Females] should be a structure that holds heights and times, but you have it as an array of heights. I think you want something like this:
female_times = struct('Manual',manual_time,'Matlab',matlab_female);
Female = struct('Heights',female,'Times',female_times);
% ditto for males to make struct Male
SortedHeights=struct('Female',Female,'Male',Male)
FWIW, I would question using an information architecture like this in the first place. Why not, for example, just keep the times in a 2x2 array (gender, manual/matlab)?