MATLAB: Couldn’t run codegen under matlab

MATLABmatlab coder mex codegensimulink coder

I have trial version of matlab coder,and download a sample coder from mathwork: hello_world. and followed the instruction of how to setup and run the sample.
when I tried to run codegen to generate mex function within matlab, I get a error message like: >> codegen hello_world ??? cp: preserving permissions for `/var/local/scratch/qguan/coder2/coderdemo_hello_world/codegen/mex/hello_world/mexopts.sh': Operation not supported
I checked uid and gid for the current workfolder, it is set all fine and rw enabled.
what else I should be looking into? or is it known issue?
Thanks so much for your help! Qingyan

Best Answer

The codegen command uses
>> copyfile(<source_file>,<dest_dir>,'f')
to copy mexopts.sh, which is typically found in [matlabroot '/bin']. You could try executing this command to see if it fails.
If the issue is related to permissions, you might try running mex -setup. This can be used to copy mexopts.sh to your prefdir (to which I presume you have write permission) and you could then modify the permissions on the file in your prefdir. The codegen command will give preference to the mexopts.sh file in the prefdir over the one in the bin directory.
-John