The first is for executing one or more lines of Octave, while the latter allow moving variables between the Octave and Python workspace.
Here you see an example of how to execute a single line of Octave, and how to transfer the generated value back to Python:

In [2]:

x=%octave [1 2; 3 4];
x

Out[2]:

array([[ 1., 2.],
[ 3., 4.]])

In [3]:

a=[1,2,3]%octave_push a
%octave a = a * 2;
%octave_pull a
a

Out[3]:

array([[2, 4, 6]])

When using the cell magic, %%octave (note the double %), multiple lines of Octave can be executed together. Unlike
with the single cell magic, no value is returned, so we use the -i and -o flags to specify input and output variables. Also note the use of the semicolon to suppress the Octave output.

%%octave -s 600,200 -f png# Note: On Windows, this will not show the plots unless Ghostscript is installed.subplot(121);[x,y]=meshgrid(0:0.1:3);r=sin(x-0.5).^2+cos(y-0.5).^2;surf(x,y,r);subplot(122);sombrero()

Plots can be drawn inline (default) or bring up the Octave plotting GUI by using the -g (or --gui) flag: