bloc MATLAB function directory error

2 views (last 30 days)
Hello, I have a little problem with the "MATLAB function" bloc of simulink. I'm using matlab 2011a, I made a very basic circuit, in input of the bloc "MATLAB function" there is a bloc "Repeating Sequence" and in output just a scope. I didn't change the code of fcn bloc. However, when I launch the simulation the following error appear:
The current directory is c:\program files\matlab\r2011a\bin, which is reserved for MATLAB files. Please change your current directory to a writable directory preferably outside of MATLAB installation area
I tried to change the saving directory, but nothing changed, always the same error. Do you have any idea how I could solve this problem?
Thank you,

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 27 Jan 2012
What do you get when you execute the following commands in MATLAB:
>> pwd
>> !cd

More Answers (4)

Jerem
Jerem on 27 Jan 2012
It works! Thank you
  4 Comments
hesham ibrahim
hesham ibrahim on 29 Jul 2017
thanks marwa its the only way working on my prog
Jan
Jan on 10 Mar 2018
[MOVED from flag]:
Sherif Said wrote: Thanks Marwa.
@Sherif Said: Please use flags only to inform admins and editors about contents, which might conflict with the terms of use, e.g. by rudeness or spam. Thanks.

Sign in to comment.


M Asif
M Asif on 18 Dec 2013
How can I change current saving directory?
Many thanks in advance.
  1 Comment
Kaustubha Govind
Kaustubha Govind on 18 Dec 2013
You can use "cd C:\some\other\path" at the MATLAB prompt to change the current directory.

Sign in to comment.


Jerem
Jerem on 27 Jan 2012
Edited: Walter Roberson on 22 Dec 2015
I get :
>> pwd
ans =
C:\Program Files\MATLAB\R2011a\bin
>> !cd
C:\Program Files\MATLAB\R2011a\bin
>> pwd
Even if I saved the file in a other folder ...
  2 Comments
Kaustubha Govind
Kaustubha Govind on 27 Jan 2012
You also need to change your MATLAB current directory to the folder containing the file. Use the cd command.
Kaustubha Govind
Kaustubha Govind on 27 Jan 2012
After that, "pwd" should return the folder where your model is saved.

Sign in to comment.


shantanu srivastava
shantanu srivastava on 28 Jan 2018
Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!