communicate between matlab and arudiono mega2560

I know this post is as old as time itself but I just wasted at least an hour or two on the same problem so I wanted to post what worked for me.

in the Simulink preferences you need to make sure the simulation cache folder and code generation folder are not set to the matlab installation area (C:\Program Files\MATLAB\R2012a\bin) which of course it is by default, also make sure your working directory is not the install folder but that should be obvious.