Tips for golfing in Octave
Once you know, that a is free of zero values, using nnz(a) spares you 2 chars compared to numel(a).
Prefer a(a==0) to a(find(a==0)).
~t is shorter than t==0 , and even ~~t is shorter than t!=0.
0*(1:n) is shorter than zeros(1,n)
Generally, || and &amp;&amp; , unlike many other operators, scalarize the result when the first argument is a scalar. For matrices, only non-empty matrices without elements equal to zero have the logical value of true.

Hence, we can do 0||m instead of all(all(m)) for any matrix.

Try with 0||[1 1;1 0] and 0||[1 1;1 1] to convince yourself.
When you are using a builtin a number of times, do a function handle to spare characters eg. f=@find . For short function names at least 3 occurrences justify this, for long ones - even with two occurrences.
When a function is a single statement, prefer f=@(n)dosomething(n) notation to function r=f(n)r=dosomething(n);end one.
Unfortunately, global variables have to be declared both in global scope and in each function using them. But there is an exception: anonymous @(n)... functions "see" all variables from the scope where they are called from.
It's possible to do f(a=0,b=0) instead of a=0;b=0;f(a,b).
This seems undocumented feature, but the order of evaluation is from left to right (checked at v. 3.8.1), you can do zeros(a=n,b=a*a) to both create a n x n^2 matrix and store it's row and column number in a and b variables.
The operator precedence table is your friend. Don't do b=(a==0) since b=a==0 is the same.