MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Anand
on 28 Mar 2013

I wrote a simple function to swap variables. I am using MATLAB in Win 7.

function [x,y]= swap(u,v) x=v; y=u;

I get a make error stating

"Making simulation target "ex2_sfun", ...

C:\Users\....(some location)>"c:\users\(some location)" -f ex2_sfun.lmk The system cannot find the path specified."

I get Parse Ok and Code Ok.

What might be the problem? Please help me.

Answer by Ahmed A. Selman
on 28 Mar 2013

Probably there is a simulink model with the same name. Try to use a slightly different function name for youe swap function such as swap01 or swapThem..etc. Also check your path and set it to current Matlab directory. Regards.

Anand
on 28 Mar 2013

Hi, I am a newbie. How to set path to current Matlab directory ?

"pwd" command gives me C:/Documents/Matlab" . Is it my Matlab directory ? Where shud I set this path ?

Regards

Ahmed A. Selman
on 29 Mar 2013

From Matlab menu (File), then goto (Set Path) and click on (Add Folder) to add a single directory or (Add with subfolders) to add a folder and its children. You can also type

pathtool

to reach the same interface.

Don't forget to click (save) after you finish setting your path :)

## 5 Comments

## Kaustubha Govind (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/68933#comment_139535

Could you run the command

getenv PATHin MATLAB and see if one of the following is true:## Anand (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/68933#comment_139554

There is no "&" or "C:/Windows/System32/..." in the path variable.. There are lots of paths separated by semicolons (;)..

## Kaustubha Govind (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/68933#comment_139791

Okay, the pronlem could be that you are missing System32 on your PATH variable. Could you make sure that "C:/Windows/System32/" exists on your machine and add that to the System PATH environment variable? Then restart MATLAB and try your model again.

## Anand (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/68933#comment_140378

Hi.. By System PATH u mean the Path variable in Environmental variables of computer properties? I added in that and still it not working. Again it is giving me Make Error.

## Kaustubha Govind (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/68933#comment_140390

Now, when you run "getenv PATH" from MATLAB, does "C:/Windows/System32/" show up in the list?