Error when build MATLAB

Welcome.
This issue was recently discussed on the forum here: Using MATLAB Package with R2022b and R2021b downloaded

Have a look at the README on the Matlab.jl GitHub page. You may need to use version R2021, and a Julia installation, using Rosetta.