Azure Devops Pipeline Matlab Command Bugs between R2019B and R2017B

0 votes

I have a working Azure CI pipeline doing building code-gen operations with Matlab 2019. The Matlab project is written for Matlab 2017B. it also builds/works locally with Matlab 2017b or 2019b.


It's a self-hosted Windows 10 computer connected to Azure Pipelines with multiple versions of Matlab. Matlab 2017B is a node-locked license. Matlab2019B is a floating license.


I changed the Matlab version used by the script to 2017B and ran my script to match the production server specification.

  - powershell: Write-Host '##vso[task.prependpath]C:\Program Files\MATLAB\R2017B\bin'  
  - task: RunMATLABCommand@0
      command: myscript


It to run without issues. Or, have 1-2 compatibility issues in the script, that I can debug as I go along.


It can't even set Matlab path when it inits. (Which is step 1 of opening Matlab, not even part of my script ), hence it has access to no standard Matlab function, and everything breaks.

C:\WINDOWS\system32\cmd.exe /D /S /C "C:\agentS\_work\_tasks\RunMATLABCommand_28fdff80-51b4-4b6e-83e1-cfcf3f3b25a6\0.2.6\bin\run_matlab_command.bat "cd('C:\agentS\_work\_temp'); command_1ae12f20_c2aa_4b55_9c6c_6da1d64c4a30""
C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m: Cannot open file: permission denied.
[Warning: MATLAB did not appear to successfully set the search path. To recover for this session of MATLAB,
type "restoredefaultpath;matlabrc". To find out how to avoid this warning the next time you start MATLAB,
Undefined function or variable 'pwd'.

Error in buildSequence (line 1)

Error in command_1ae12f20_c2aa_4b55_9c6c_6da1d64c4a30 (line 2)
ERROR: MATLAB error (starter line:1202) Exit Status: 0x00000001


These are my finding & what I tried.

  1. check access right to file

This is my access to the 2 files for Matlab 2019, 2017.

-rw-r--r--  1 NARCISS Administrators  39652 Aug 17 13:35 pathdef.m (2017B Matlab)

-rw-r--r--  1 NARCISS Administrators  45073 Sep 14 17:11 pathdef.m (2019B Matlab)
  1. Compare Azure & Local Access to file

I know from Running this locally from my computer, from a terminal not in admin mode:

cat "C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m"
cat "C:\Program Files\MATLAB\R2019b\toolbox\local\pathdef.m"

That both files print to the terminal.

And Running this from an Azure Pipeline with a Self-Hosted Windows computer(same computer as local), from a terminal not in admin mode:

cat "C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m"
cat "C:\Program Files\MATLAB\R2019b\toolbox\local\pathdef.m"

1st File get access denied, second print as regular.

So this could explain why the script run well in 2019, but fail in 2017 because it doesn't have access right to the file?

  1. Try to replicate the error on Matlab locally

I opened Matlab GUI and Matlab CLI, locally and tried said problematic line, without any issue.

  1. Trying an online solution to update pathdef.m

I tried doing these steps, with no change:

2020-10-02T14:02:11.6188893Z "-------------------------------------------------------"
2020-10-02T14:02:11.6473143Z ls: C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m: Permission denied
2020-10-02T14:02:11.6486563Z 885076267 -rwxr-xr-x 1 AI*****$ Administrators 39330 Oct  1 14:10 C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m
2020-10-02T14:02:11.6511012Z "-------------------------------------------------------"
2020-10-02T14:02:11.6702428Z 1671000 -rw-r--r-- 1 AI****$ Administrators 45073 Sep 14 17:11 C:\Program Files\MATLAB\R2019b\toolbox\local\pathdef.m
2020-10-02T14:02:11.6722373Z "-------------------------------------------------------"


I'm kind of stuck. I don't understand the difference in behavior between local CLI and Azure pipeline CLI? Any Idea on how to fix this bug?

Apr 2, 2022 in Other DevOps Questions by Kichu
• 19,050 points

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Other DevOps Questions

0 votes
1 answer
0 votes
0 answers

What is the difference between Azure devops and VSTS

I integrated VSTS with our testing environment ...READ MORE

Mar 26, 2022 in Other DevOps Questions by Kichu
• 19,050 points
0 votes
0 answers
0 votes
1 answer
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP