Message appearing on start of the Matlab 2019a

조회 수: 15 (최근 30일)
Gagandeep Sharma
Gagandeep Sharma 2019년 7월 21일
댓글: Gagandeep Sharma 2019년 7월 22일
Following message appears on the start of MATLAB
Cannot create file migratePref.txt!
java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at com.mathworks.services.Prefs.readMigrateFlag(Prefs.java:2153)
at com.mathworks.services.Prefs.createTwoWayMapPrefsSettings(Prefs.java:373)
at com.mathworks.services.Prefs.<clinit>(Prefs.java:214)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.util.PostVMInit$StartupClass.init(PostVMInit.java:156)
at com.mathworks.util.PostVMInit.perform(PostVMInit.java:187)
On trying to start the simulink following message is coming
simulink
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
An error was encountered while saving the command history
java.io.FileNotFoundException: C:\MATLAB_preferences \History.xml (The system cannot find the path specified)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at com.mathworks.mde.cmdhist.AltHistoryCollection$CommandSaver.run(AltHistoryCollection.java:1214)
at java.lang.Thread.run(Thread.java:748)
Please suggest the solution

답변 (2개)

Gagandeep Sharma
Gagandeep Sharma 2019년 7월 21일
I got following kind of message in command window on the launch of MATLAB and simulink
Cannot create file migratePref.txt!
java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at com.mathworks.services.Prefs.readMigrateFlag(Prefs.java:2153)
at com.mathworks.services.Prefs.createTwoWayMapPrefsSettings(Prefs.java:373)
at com.mathworks.services.Prefs.<clinit>(Prefs.java:214)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.util.PostVMInit$StartupClass.init(PostVMInit.java:156)
at com.mathworks.util.PostVMInit.perform(PostVMInit.java:187)
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
The desktop configuration was not saved successfully
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
>> simulink
An error was encountered while saving the command history
java.io.FileNotFoundException: C:\MATLAB_preferences \History.xml (The system cannot find the path specified)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at com.mathworks.mde.cmdhist.AltHistoryCollection$CommandSaver.run(AltHistoryCollection.java:1214)
at java.lang.Thread.run(Thread.java:748)
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
>>
Please advise the step wise solution in detail. that how can I fix the problem. The abovesaid links are not understandable to me.
  댓글 수: 3
Gagandeep Sharma
Gagandeep Sharma 2019년 7월 22일
The DOS command prompt result is attached as screen shot and MATLAB command window result is as follows:
annot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
The desktop configuration was not saved successfully
Cannot write to preference file "matlab.prf" in "C:\MATLAB_preferences ".
Check file permissions.
>> prefdir
An error was encountered while saving the command history
ans =
'C:\MATLAB_preferences '
java.io.FileNotFoundException: C:\MATLAB_preferences \History.xml (The system cannot find the path specified)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at com.mathworks.mde.cmdhist.AltHistoryCollection$CommandSaver.run(AltHistoryCollection.java:1214)
at java.lang.Thread.run(Thread.java:748)
Please see
Walter Roberson
Walter Roberson 2019년 7월 22일
At the MATLAB command window, please show the output of these two commands:
!echo %MATLAB_PREFDIR%
!echo %USERPROFILE%
!set
The ! are part of the commands.

댓글을 달려면 로그인하십시오.


Gagandeep Sharma
Gagandeep Sharma 2019년 7월 22일
Following are the outputs
>> !echo %MATLAB_PREFDIR %
%MATLAB_PREFDIR %
>> !echo %USERPROFILE %
%USERPROFILE %
>> !set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\gaggu\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-1VD041H
ComSpec=C:\WINDOWS\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
HOMEDRIVE=C:
HOMEPATH=\Users\gaggu
KMP_BLOCKTIME=1
KMP_HANDLE_SIGNALS=0
KMP_STACKSIZE=512k
LOCALAPPDATA=C:\Users\gaggu\AppData\Local
LOGONSERVER=\\DESKTOP-1VD041H
MATLAB_ARCH=win64
MATLAB_PREFDIR=C:\MATLAB_preferences
NUMBER_OF_PROCESSORS=4
NVIDIAWHITELISTED=0x01
OneDrive=C:\Users\gaggu\OneDrive - uoit.net
OneDriveCommercial=C:\Users\gaggu\OneDrive - uoit.net
OS=Windows_NT
Path=C:\Program Files\MATLAB\R2019a\bin\win64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\MATLAB\R2019a\bin;C:\Users\gaggu\AppData\Local\Microsoft\WindowsApps;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=8e09
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
QT_QPA_PLATFORM=windows:fontengine=freetype
SESSIONNAME=Console
SHIM_MCCOMPAT=0x800000001
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\gaggu\AppData\Local\Temp
TMP=C:\Users\gaggu\AppData\Local\Temp
USERDOMAIN=DESKTOP-1VD041H
USERDOMAIN_ROAMINGPROFILE=DESKTOP-1VD041H
USERNAME=gaggu
USERPROFILE=C:\Users\gaggu
windir=C:\WINDOWS
__KMP_REGISTERED_LIB_11360=00007FFFD574E2B4-cafed1e7-libiomp5md.dll
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 7월 22일
You consistently added a space to the command. I did not say
!echo %MATLAB_PREFDIR %
I said
!echo %MATLAB_PREFDIR%
exclamation-mark e c h o SPACE percent M A T L A B underscore P R E F D I R percent
not
exclamation-mark e c h o SPACE percent M A T L A B underscore P R E F D I R SPACE percent
Anyhow, the result of !set shows:
MATLAB_PREFDIR=C:\MATLAB_preferences
which is what we needed to know.
You should follow the directions at https://www.architectryan.com/2018/08/31/how-to-change-environment-variables-on-windows-10/ and DELETE the environment variable named MATLAB_PREFDIR
Note: if you are working on a corporate system, or working on a system set up by a university IT team, then you might possibly not have administrator access to change this variable, or the variable might be set by GROUP Policy. If so you might need to get the IT people to change the variable.
If changing the variable is not possible for some reason, then at the very least, someone with admin access should create the directory C:\MATLAB_preferences and give you write access.
If changing the variable is not possible, and creating that directory is not possible, then you should consider creating a .bat file that does
SET MATLAB_PREFDIR=
and then starts MATLAB.
Gagandeep Sharma
Gagandeep Sharma 2019년 7월 22일
I did not added any space to the command. I only copy paste the command on MATLAB command window. I tried again by deleting the space, again after copying and pasting as follows:
>> !echo%MATLAB_PREFDIR%
The filename, directory name, or volume label syntax is incorrect.
>> !echo %MATLAB_PREFDIR%
C:\MATLAB_preferences
>>
I will now do the other task which you suggested.
Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by