Matlab Function Block with error generated by Stateflow

조회 수: 8 (최근 30일)
want2know
want2know 2013년 7월 10일
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:
1. Change to other directory outside of Matlab installation area
2. mex set up to select the correct compiler in my system (Microsoft Visual 2010)
3. 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.

채택된 답변

Kaustubha Govind
Kaustubha Govind 2013년 7월 10일
The MATLAB Function block and Stateflow share some common infrastructure, which is why you will sometimes see error messages as being reported by Stateflow. I'm surprised that you still see the same error even after changing the current working directory outside of MATLAB installation area though. What does running the command "pwd" at the MATLAB prompt return?
  댓글 수: 5
Kaustubha Govind
Kaustubha Govind 2013년 7월 11일
The MATLAB Function block automatically generates C code from the MATLAB code for execution - this code is generated into the current working directory - and hence can "litter" your current working directory. In general, it is bad practice to litter the installation area with user data, which is why the error message is used to discourage this. Note that on newer Windows systems for instance, you need admin privileges to write to the "Program Files" directory.
It's not clear what you are asking in your second question. Are you saying that you are getting dimension propagation errors when using an S-function? If so, you may not have configured your S-function properly. However, this is a longer discussion, and if you would like to continue it, please create a new question.
want2know
want2know 2013년 7월 11일
Thanks for your detailed reply, it is very informative to me!
I have created a new question for the second question here http://www.mathworks.com/matlabcentral/answers/81495-s-function-dimension-matching-problem-with-lots-of-terminator-blocks, could you please spend couple of minutes to have a look on the link below, please, just give any keyword will do, I will try to find the details and understand, please

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

want2know
want2know 2013년 7월 16일
Hi Kaustubha Govind,
Thanks for your detailed reply, it is very informative to me!
I have created a new question for the second question here http://www.mathworks.com/matlabcentral/answers/81495-s-function-dimension-matching-problem-with-lots-of-terminator-blocks, could you please spend couple of minutes to have a look on the link below, please, just give any keyword will do, I will try to find the details and understand, please

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by