MATLAB Answers

0

Simulink, Arduino,

Asked by Daniel Potts on 1 Oct 2016
Latest activity Commented on by Walter Roberson
on 18 Oct 2016
I'm testing a Pulse Generator and Digital Output with the Arduino Uno/ simulink library. After clicking, "deploy to hardware," Under Code Generation, I get the error:
'D:\Program' is not recognized as an internal or external command, operable program or batch file.
### Build procedure for model: 'untitled' aborted due to an error. Error(s) encountered while building "untitled": ### Failed to generate all binary outputs.

  1 Comment

Swarooph
on 4 Oct 2016
What's your current folder? You can retrieve this using the command pwd. You need write permissions in the current directory for you to be able to deploy the model. I am suspecting you are in a 'Program Files' folder or some other system folder.. Try doing this from the Desktop or My Documents folder.

Sign in to comment.

Products

2 Answers

Answer by Anusha Sridharan on 6 Oct 2016

This looks like it could be due to the way your environment variables might be set up. From your error message, it look like the path is being incorrectly read as 'D:\Program' instead of 'D:\Program Files\...'
You could try replacing the 'Program Files' part of the path with 'Progra~1' or 'Progra~1' if for Program Files (x86) such that the folder is looked up correctly. You could also restore your PATH and other environment variables to their initial values by entering the following in the MATLAB Command Window:
>> restoredefaultpath
>> rehash toolbox
>> save path
However, note that this would reset all of your environment variables to the default values and you would have to manually re-add the path to any custom/third-party toolboxes.

  3 Comments

Longhai ZHAO on 16 Oct 2016
How to replace the 'Program Files' part of the path with 'Progra~1' ?
Walter Roberson
on 16 Oct 2016
Longhai ZHAO on 17 Oct 2016
Thanks a lot.

Sign in to comment.


Walter Roberson
Answer by Walter Roberson
on 6 Oct 2016

Some of the older Simulink releases were not able to handle spaces or non-ASCII characters in directory names or file names. Sometimes the problem was in third-party tools.
The easiest way to handle this is to create a new (series of) directories from the top of a drive filesystem, with no spaces or non-ASCII characters in the names, and to copy the models into there, and to build there.
Sometimes, though, you also ended up needing to install the tools themselves into safe directory names.
I think the last couple of releases have caught the majority of the problems. It would, however, not surprise me if some of the toolkits for something like Xilinx are not completely safe.
The problem has to do with the tools blindly substituting in full filenames (with directories) into scripts without putting double-quotes (") around the names. For example
mkdir %DESTINATION%
would fail if %DESTINATION% had a space in it; a safe tool would have used
mkdir "%DESTINATION%"

  2 Comments

Longhai ZHAO on 18 Oct 2016
Thank you very much for your answer in "https://cn.mathworks.com/matlabcentral/answers/305340#comment_398984"
I have replaced 'Program Files' part of the path with 'Progra~1', but the same error comes again. Would you please help me to handle this problem? Thank you very much.
Walter Roberson
on 18 Oct 2016
Unfortunately I do not have an Arduino so I cannot completely install the Support Package or trigger a Deploy to Hardware.

Sign in to comment.