MATLAB: Mixed anova design function (unbalanced design)

Hi, I am trying to run a mixed (between and within design) anova and it seems like matlab does not have the function for that. I used the code as provided here (https://www.mathworks.com/matlabcentral/fileexchange/27080-mixed-between-within-subjects-anova) but it is not able to run with an unbalanced design i.e the within subject factor in my dataset has varying levels, but the code only runs it when it has same levels.
Is there a function out there that anyone may direct me to, to solve this issue?
Would be very grateful, thank you!

Disclaimer: I'm not an expert in statistical test selection and have met very few experts on this matter. Test selection should always consider the assumptions, the null hypothesis, and whether or not your experimental methods are appropriate for the test.
From what I undersand you have a categorical independent variable, More|Less light exposure, where each level was applied to different groups of people. You have a continuous independent variable, hours of sleep during pre-expt, that potentially differs between all subjects. And you have dependent variable you're measuring which you didn't mentioned, perhaps something like serotonin or melatonin levels. You want to make sure the hours of sleep hasn't significantly affected the outcome of the DV.
A ANCOVA analysis will answer this question. An ANCOVA evaluates whether the means of the DV are equal across levels of the categorical IV (More|Less light) while controlling for the effects of a continuous covariate sometimes called a nuisance variable [wiki].
Note that a general linear model (GLM) is the same mathematical model as an ANCOVA (see Karen Grace-Martin's concise comparison).
Recommended sources on ANCOVA & GLM
• Bingham & Fry (2010). Regression: Linear models in statistics. Chapter 5.2
• Freund, Wilson, & Sa (2006). Regression Analysis Statistical Modeling of a Response Variable. Chapter 9.6
• Brandon Foltz's excellent tutorial on ANCOVA [youtube].
• Quantitative methods in Neuroscience, Chapter 9 (on GLM) [available online]
Matlab tools & Community resources
----------------------------------------------------------------