10-28-2015 10:53 AM
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.
Solved! Go to Solution.
10-28-2015 12:03 PM
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.