Octave hangs when you first use graphic functions (plot, imagesc, etc.),

你离开我真会死。 提交于 2019-12-06 07:46:31

This problem is quite common. See for example - Cannot use Octave 4.0.0 graphics toolkit functions or Plot doesn't work in Octave 4.0.0 But I did not find any solutions for this problem. So I made my own investigation.

I ran the well-known utility process-explorer when Octave was hanging up, and I saw that Octave opens all the files in the Windows fonts folder (c:\Windows\Fonts). The size of this folder on my computer is about 400 MByte! I search google and found, that Octave can use font's cache. There is special utility and script file for creating font's cache (see comment to bug). So solution for this problem is quite simple:

  1. Go to Octave folder (c:\Octave\Octave-4.2.1\ on my computer)
  2. Run script - fc_update.bat
  3. Start Octave and check, that there is not any hang or freeze on first call of plotting functions.

There is a log of two sequential starts of this script:

c:\Octave\Octave-4.2.1>fc_update.bat
"Updating fc-cache (may take a while) ..."
C:/WINDOWS/fonts: caching, new cache contents: 1012 fonts, 0 dirs
C:/WINDOWS/fonts: failed to write cache
C:/Users/Sergey/.local/share/fonts: skipping, no such directory
C:/Users/Sergey/.fonts: skipping, no such directory
C:/Users/Sergey/AppData/Local/fontconfig/cache: cleaning cache directory
C:/Users/Sergey/.cache/fontconfig: not cleaning non-existent cache directory
C:/Users/Sergey/.fontconfig: cleaning cache directory
c:\Octave\Octave-4.2.1\bin\fc-cache.exe: failed
"Done."

c:\Octave\Octave-4.2.1>fc_update.bat
"Updating fc-cache (may take a while) ..."
C:/WINDOWS/fonts: skipping, existing cache is valid: 1012 fonts, 0 dirs
C:/Users/Sergey/.local/share/fonts: skipping, no such directory
C:/Users/Sergey/.fonts: skipping, no such directory
C:/Users/Sergey/AppData/Local/fontconfig/cache: cleaning cache directory
C:/Users/Sergey/.cache/fontconfig: not cleaning non-existent cache directory
C:/Users/Sergey/.fontconfig: cleaning cache directory
c:\Octave\Octave-4.2.1\bin\fc-cache.exe: succeeded
"Done."

I think you need to run this script when installing Octave or adding new fonts to the system. I do not understand why this information is not contained in the Octave documentation in a clear and accessible way.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!