title: Calling An Anaconda Environment from MATLAB: Conda Command Not Found
body: <p>I want to call a Python script I created in its own Anaconda environment and wanted to call the script from Matlab 2020a. However, when I try to activate the environment from Matlab, I get an error message:</p>
  
  <pre><code>system('conda activate *name_of_environment*')
  /bin/bash: conda: command not found
  </code></pre>
  
  <p>I installed the newest version of anaconda3 (2020.02) on a Ubuntu 18.04 machine and, as recommended, didn't add conda to bashrc but added the conda.sh directory instead as recommended <a href="https://stackoverflow.com/questions/52779016/conda-command-working-in-command-prompt-but-not-in-bash-script">here</a>:</p>
  
  <pre><code># &gt;&gt;&gt; conda initialize &gt;&gt;&gt;
  # !! Contents within this block are managed by 'conda init' !!
  __conda_setup="$('/home/michael/anaconda3/bin/conda' 'shell.bash' 'hook' 2&gt; /dev/null)"
  if [ $? -eq 0 ]; then
      eval "$__conda_setup"
  else
      if [ -f "/home/michael/anaconda3/etc/profile.d/conda.sh" ]; then
          . "/home/michael/anaconda3/etc/profile.d/conda.sh"
      else
          export PATH="/home/michael/anaconda3/bin:$PATH"
      fi
  fi
  unset __conda_setup
  # &lt;&lt;&lt; conda initialize &lt;&lt;&lt;
  
  # export PATH="/home/michael/anaconda3/bin:$PATH"  # commented out by conda initialize
  
  #Enable conda to be called from bash
  source /home/michael/anaconda3/etc/profile.d
  </code></pre>
  
  <p>However, I can't find an explanation how to run conda from Matlab otherwise. Am I missing something?</p>
  
  <p>Thanks a bunch, and best,</p>
  
  <p>Michael</p>