LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

permission denied error when using Matlab script

Solved!
Go to solution

I have the following simple code running in a Matlab script in Labview.

 

K=5;
Matrix=randn(4,4);
matlab.io.saveVariablesToScript('Parameters.m',{'K','Matrix'})

 

the last command saves the 'K' and 'Matrix' variables into the Parameters m-file which I can then use to load the 'K' and 'Matrix' parameters to a 'Control Design and Simulation Model'. 

 

When I run this from Matlab everything works fine. When I run this from Labview though I get the following error :

 

LabVIEW: Error occurred while executing script. Error message from server: ??? Error using matlab.io.saveVariablesToScript
Parameters.m: Cannot open file: permission denied.

 

I use Matlab 2015 and LAbview 2015 in a windows 7 64bit machine.

 

Any help would be really appriciated.

0 Kudos
Message 1 of 2
(4,464 Views)
Solution
Accepted by topic author iliaszazas

For anyone with similar permission denied errors I found the solution.

 

I had to specify in the matlab script the actual working directory (that is the directory to which you have saved your LAbview VI).

 

For example if you have saved your labview vi into C:\Example_Folder

 

then you have to add the following command into your matlab script node before the command which is causing the error

 

cd('C:/Example_Folder')

 

 

I hope this will help.

 

0 Kudos
Message 2 of 2
(4,450 Views)