I have a large Matlab project, and due to an issue with xlsread and Mac OS, I have included a Mac switch. If that switch is on, I want Matlab to execute a python script through a system command as such:
cmdStr = 'python3 osx_conversion.py'
if osxSwitch == 1
[status,result] = system(cmdStr);
if status ~= 0
error('System could not run Python conversion file')
end
else
...
This returns the result:
/bin/bash: python3: command not found
Now, if instead I use 'python osx_conversion.py', the error I get is to do with using python 3 syntax, as the command python on my mac calls python 2. Any ideas as to what is going on will be really appreciated.
EDIT: To clarify, if I run 'python3 osx_conversion.py' through the terminal it runs smoothly
EDIT 2: Result from running
echo $PATH
in the terminal:
/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/opt/X11/bin:/opt/ImageMagick/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin
echo $PATHin terminal and post the result herecmdStr = 'python3 osx_conversion.py'tocmdStr = '/anaconda3/bin/python3 osx_conversion.py'(firstly, run/anaconda3/bin/python3 osx_conversion.pyin terminal just to make sure it works)