Watch this Author's files
It don't work for me sorry
very useful, thank you!
In some cases it happens, that the max point is not displayed, so i extended your code... (Not fine, but useful.)
zedges=linspace( (minz - 0.00001 * minz) , (maxz + 0.00001 * maxz) ,n+1);