GNU Octave can install third-party packages in a friendly way, analogous to the Matlab App Store or how Linux repositories work.
Regardless of operating system, Octave can install these extension packages from the Octave command line.
Some packages require a compiler or libraries.
If package install fails, read the log output to see if installing a system library is required.
Packages are installed at the Octave command prompt, and download automatically.
Prereqs are not automatically installed, but messages are given telling which package needs to be installed first.
signal is a perfect example of this, given below.
“signal” is a popular Octave package, which brings many functions found in Matlab’s DSP and Communications Toolbox.
We’ll see that signal needs other packages first; let’s walk through the Octave signal install.
All commands are from Octave command prompt.
Try using a command that requires signal
diric(0.2, 5)
warning: the ‘diric’ function belongs to the signal package from Octave Forge which seems to not be installed in your system.
If I had already installed signal, but forgotten to load it since I started Octave, the error would have been:
warning: the ‘diric’ function belongs to the signal package from Octave Forge which you have installed but not loaded.
Install signal Octave package from Octave prompt:
pkg install signal
This returns a warning saying that control is required.
Install control:
pkg install control
this requires the gfortran compiler.
pkg install signal
Use Octave packages in a Matlab-compatible way simply by enclosing in tryend
functiond =twicediric(x)try pkg load signalend d = 2*diric(x)end
If the package isn’t installed, the message on reaching the missing function tells which package is needed.
Matplotlib can make many types of plots with a time axis.
However, sometimes it takes an additional command or two to make the date/time axis work right in Matplotlib.
As seen in
xarray_matplotlib.py,
for imshow() datetime64 extent, you need to do something like:
importmatplotlib.datesasmdates# whatever your time vector ist = np.arange('2010-05-04T12:05','2010-05-04T12:06', dtype='datetime64[s]').astype(datetime)
mt = mdates.date2num((t[0],t[-1]))
ax.imshow(im, extent=[mt[0],mt[1], y[0],y[-1]], aspect='auto')
In most Matplotlib plotting functions numpy.datetime64 is a first-class citizen, but not yet for imshow() perhaps due to the limits-oriented nature of imshow().
We use pcolormesh() instead of imshow() for datetime-oriented raster data.
Select “Computer Vision System Toolbox OpenCV Interface by MathWorks Computer Vision System Toolbox Team” and install.
Note: the examples require particular compilers depending on Matlab version and operating system.
Examples directory contains Computer Vision Toolbox examples from the Mathworks.
Find the Matlab OpenCV example directory, in Matlab:
fileparts(which('mexOpenCV'))
The examples below assume you’re starting from this directory.
See the README.txt in each directory for compilation details.
Some examples require a CUDA GPU.
Foreground Detector: build example
cd ForegroundDetector
mexOpenCV backgroundSubtractorOCV.cpp
If the example fails to compile due to compiler mismatch, follow the instructions given in the error message.
Run the OpenCV Matlab demo:
testBackgroundSubtractor
You will see a Video Player window pop up with cars driving by, with the
cars detected outlined in white rectangles.
In both Matlab and GNU Octave, functions like error and warning by default print messages to stderr in non-interactive sessions, for easier capture to uncluttered log files.
To print to stderr in general, use
fprintf(2, 'Hello text')
Verify these are printing to stderr by appending to the end of the command line command: 2>err.log
Fortran languages standards keep long backward compatibility.
Fortran 2018 finally deprecated Fortran 1958 fixed width format.
In general across languages, compiler vendors take years to add the full language feature set.
Automatically determining if a particular compiler supports a needed modern Fortran feature is straightforward with CMake (and Meson).
This CMake example is for
error stop.
Unlike C++, we do not typically need to enable modern Fortran features with specific compiler flags.
Modern Fortran features are typically enabled by default.
include(CheckSourceCompiles)set(CMAKE_TRY_COMPILE_TARGET_TYPESTATIC_LIBRARY)# save link time, only compile is needed
check_source_compiles(Fortran"program test
error stop
end"f08errorstop)if(f08errorstop)...
endif()
Assumes: Windows laptop connecting to a remote Windows PC with
OpenSSH server and client
built into Windows.
Remote PC IP
Remote PC SSH port
Remote PC RDP port
1.2.3.4
22 (open TCP firewall)
3389 (blocked by remote PC firewall)
Setup: on the Windows laptop, create script file sshrdp.bat:
start /b ssh -L 3391:localhost:3389 %1@echo off
REM enough time to enter passwordtimeout /nobreak 10
mstsc /v:localhost:3391
Usage: from that directory, type sshrdp myhostname to connect RDP over SSH to myhostname computer that’s setup in your ~/.ssh/config file or via the IP address or hostname directly.
sshrdp.bat:
makes the SSH connection (you’ll be prompted for SSH password, or use a public key file)
makes the RDP connection over the SSH tunnel (where you will be prompted for the Windows password).