function [Ms, xs, ys] = lp_thin(M, x, y, maxn) % LP_THIN Subsample a field so that a picture of it fits in a JSON message. % % Keeps at most maxn points in each direction, always including both ends. nx = numel(x); ny = numel(y); ix = round(linspace(1, nx, min(nx, maxn))); iy = round(linspace(1, ny, min(ny, maxn))); Ms = M(iy, ix); xs = x(ix); ys = y(iy); end