Across operating systems, “hibernate” is a power-saving state that saves the current session to disk and powers down the computer, allowing for a quick resume later while not having the long-term battery drain of suspend mode that keeps the RAM powered.
Sometimes as part of diagnosing problems or ensuring that a remote computer stays powered on, hibernate might be disabled.
If restoring such a computer to personal use, or if experiencing issues where a laptop computer has a drained battery after a couple days of non-use, it may be useful to enable hibernate mode.
Check the current state of hibernate mode by running the following command in Windows Terminal:
powercfg /availablesleepstates
If hibernate is enabled, the output will include “Hibernate” in the list of available sleep states.
To enable hibernate mode:
powercfg /hibernate on
However, the option in Control Panel → Power Options → Change plan settings → Change advanced power settings → Sleep → “Hibernate after”
may not be available until making the following registry change:
Enable the hibernate timer setting, where the values are in minutes:
powercfg /setACvalueindex scheme_current SUB_SLEEP HIBERNATEIDLE 43200# 12 hours hibernate while plugged into AC power (or set to 0 for never)powercfg /setDCvalueindex scheme_current SUB_SLEEP HIBERNATEIDLE 10800# 3 hours hibernate while on battery (or set to 0 for never)powercfg /setactive SCHEME_CURRENT
# Set the current power scheme to apply changes
Matlab version upgrade and AddOns installer was significantly changed in Matlab R2025a.
Matlab release upgrades can be initiated from the “bell” icon or from the
Matlab Help menu.
Upgrading or Add-On install requires a graphical connection to the computer (Remote Desktop, VNC, or similar).
Offline installs
are considerably more complex and are not for the typical Matlab user.
The bell icon on the upper right corner of the Matlab Desktop typically shows when a Matlab update is available.
Matlab can force checking for update, even if the bell is not showing an update, with our script
MatlabReleaseUpgrade.m.
Matlab
Add-On Explorer
is launched from the Matlab Desktop and requires a graphical connection.
The
mpm CLI installer
can be used to install Matlab and Add-Ons from the command line.
On macOS, Matlab does not source any shell configuration files like ~/.zshrc or ~/.bashrc.
Any environment variables set in these files, such as those added by package managers like Homebrew, will not be available in the Matlab environment.
Instead, set desired environment variables in the Matlab startup.m script like:
Where “/opt/homebrew/bin” was obtained from the system command brew --prefix.
We recommend not running system() scripts in startup.m unless truly necessary to avoid delaying Matlab startup time or affecting startup stability.
Then programs installed by Homebrew like CMake, GCC, etc. will be on Path environment variable in Matlab.
Note that the Matlab commands below only affect commands withing that same command line:
Get MPI on Windows with C and Fortran by any one of:
MS-MPI,
Intel oneAPI
or Windows Subsystem for Linux libopenmpi-dev.
We often use MPI via
MSYS2
with GCC / Gfortran compilers on Windows.
Upon installing or updating Intel oneAPI compilers and libraries on Windows, you may experience CMake failing to find MPI for MinGW.
This happens because Intel compilers put Intel MPI on the system PATH.
Fix this by removing Intel MPI from the system PATH and use the Intel Compiler shell instead, which provides all the needed directories.
These techniques allow a Windows development machine to use Notepad++ more effectively.
Notepad++ is a free source code editor and Notepad.
It was first released in 2003 and is an
open source project.
winget install Notepad++.Notepad++
Notepad++ from command line:
add to user environment variable Path the binary path of Notepad++ – typically at %PROGRAMFILES%\Notepad++.
This allows using notepad++ from the Windows Terminal.
Notepad++ shortcut icon open a new window:
When using multiple virtual desktops, by default Notepad++ snaps to the other desktop when clicking the Notepad++ start menu icon.
Make the Notepad++ icon open a new Notepad++ window by editing the Notepad++ start menu shortcut, appending
-multiInst
to the right and outside of the quoted full Target path to notepad++.exe.
This allows opening multiple Notepad++ windows, each with its own set of tabs.
Notepad++ open directory as project:
To open a directory as a project, use the command line option -openFoldersAsWorkspace followed by the path to the directory.
We have found this is often a server-side configuration issue, particularly when it only occurs with a specific server.
The server may be using an older version of OpenSSH that still supports arcfour-hmac, or it may have been configured to allow this encryption type.
To check settings in the SSH client configuration file, look for lines that specify Ciphers or MACs.
If arcfour-hmac is listed, it should be removed.
The Matlab external language interface to Python in Matlab releases before R2022a has a bug with the JIT compilation via
Matlab execution engine
such that any mention of the py.* namespace will make a function unusable if Python is not
available.
Especially problematic is functions that can work without Python (say in an if-else or switch block) where the mere presence of a py.* call will cause the entire function to fail if Python is not available.
To workaround this issue in Matlab older than R2022a, use a private function to encapsulate the Python call.
This way, the main function will not be affected by the Python call.
functionresult =my_fun2(input)if has_python()
result = encaps_fun2(input);
else% fallback code when Python is not availableendend
Make a private function in file “private/encaps_fun2.m”:
functionresult =encaps_fun2(input)result = py.some_module.some_function(input);
end
Matlab external language
interfaces
includes .NET on Windows, Linux, and macOS.
This allows efficiently calling .NET assemblies and using .NET libraries directly from Matlab.
The Matlab function
dotnetenv
is used to set up and check the active .NET environment in Matlab.
Environment variable DOTNET_ROOT is vital for Matlab to detect the .NET installation, particularly on Linux and macOS.
If Matlab is having issues detecting the .NET installation NET.isNETSupported is false, determine the value for DOTNET_ROOT from system Terminal:
dotnet --info
If “dotnet” command is not found, install .NET SDK:
macOS: brew install dotnet
Windows: winget install Microsoft.DotNet.SDK.9 # whatever the desired version is
Matlab Online (Linux): if .NET isn’t detected, use .NET install script to install .NET SDK.
Find the “dotnet” executable and run dotnet --info to get the DOTNET_ROOT path.
If this path is not defined, look for the Base Path, and pick the directory that contains the “dotnet” executable.
Set the DOTNET_ROOT environment variable in Matlab by adding to Matlab startup.m so that future Matlab sessions have the correct DOTNET_ROOT set.
edit(fullfile(userpath,'startup.m'))
Then add the following line to startup.m:
setenv("DOTNET_ROOT", <DOTNET_ROOT path from dotnet --info>)
Restart Matlab.
Do the following one-time command to finish setting up .NET in Matlab:
dotnetenv("core", Version=8)
The Version number must match the major version of .NET in DOTNET_ROOT.
On future Matlab sessions, dotnetenv() will be empty until the first .NET command is run, for example
NET.isNETSupported
then (optionally) running dotnetenv() shows the current .NET environment.
On Unix-like systems such as Linux and macOS, Python can detect if a script is being run as sudo / root from the
UID,
which is by definition zero for root.
On Windows, the ctypes module can be used to check if the current user is an administrator.
Its convenient to flip an image vertically or horizontally from Terminal.
In general, modifying an image in any way including cropping, flipping, rotating, etc. is a lossy process if the image compression algorithm used is lossy such as JPEG.
Lossless compression formats such as PNG will remain lossless with this operation.
Here are examples using
ImageMagick
or
IrfanView.
Assume the input image is named “in.png” and the modified image is written to “out.png”.
IrfanView has been popular for decades on Windows and
WINE
as a no-cost (not open source) image viewing and simple modification program that handles many formats.
IrfanView can also be used from the command line.
Install IrfanView directly, not via the Microsoft App Store:
winget install IrfanSkiljan.IrfanView
The order of the commands is important.
These commands do not open the IrfanView GUI–they are “headless” operations.
If there are spaces in the file paths, they must be enclosed in quotes like
"c:/data pics/in.png"