matlab2tikz with surf function (case of non square matrices)

I apologize in advance if my question sounds a bit foolish, but I am trying to run the script in the case of the surf fonction.

The script does not run (error) if the plotted matrix is non square (surf(t, f, M) with length(t) ~= length(f)).
Even in the case of a square matrix, the script runs but does not return a correct result in the tikz file (only the first row).

Does anyone have an idea? A remark?
Best regards,
Sébastien

Likely a bug. We didn't test this function with too many configuration before pushing it out.

Pooya is looking into the issue.

Ok, finally I have had a look inside the code:

inside of the drawSurface function, I have replaced:
[col, row] = size(dx); by [col, row] = size(dz);
And
str = [ str, ...
sprintf('(%g,%g,%g)', dx(i,j), dy(i,j), dz(i,j) ) ];
by
str = [ str, ...
sprintf('(%g,%g,%g)', dx(j), dy(i), dz(i,j) ) ];
Finally, it is ok for me

Thanks for your answer,
Sébastien

Dear Sébastien, thank you for your feedback. Nice, that your modification works for your provided code, now. Surprisingly, a similar modification has already been implemented in the latest matlab2tikz located at GitHub. Cheers.

Addthis