Hi Mahmoud,
which Matlab version are you using? Unfortunately, it seems some handling of variable dimensions has changed in the most recent Matlab versions – we have seen this error on Matlab version 2015b, on 2018b, everything works fine. Still not sure about a work-around for older versions (that’s also consistent with newer versions).
Best,
Martin