I have been trying to use "Matlab Function" block for hours using very simple example from this link http://www.mathworks.co.uk/help/simulink/ug/creating-an-example-model-that-uses-a-matlab-function-block.html (see attached file), however I keep getting this errors reported by "Stateflow" (The weird thing is I do not use Stateflow): Error using construct_error (line 108) The current directory is d:\program files\matlabr\bin, which is reserved for MATLAB files.
Please change your current directory to a writable directory preferably outside of MATLAB installation area.
What I have done:
Change to other directory outside of Matlab installation area
mex set up to select the correct compiler in my system (Microsoft Visual 2010)
Generate Code for the MATLAB Function Block by selecting Build Model > Build to compile and build the model.
I have no idea what went wrong, I am pretty sure this should be a very common issue, I keep searching high and low in the internet for the solution but to no avail...
Could you please suggest the possible cause of the problem?
Many thanks in advance.