You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: grabxy.m
    path of file: ./repos/spinw/external
    
    the code of the file until where you have to start completion: function pts = grabxy(fName, ax, logax)
% reads coordinates from raster image or image on the clipboard
%
% pts = GRABXY(fName, ax, {logax})
%
% Input:
%
% fName         String, path to the image file. If empty, the image is read
%               from the clipboard.
% ax            (x,y) coordinates of the three axis points, with dimensions
%               of 2x3. If ax is omitted or empty, GRABXY just shows the
%               image.
% logax         Optional input string, cn be used if the axis is in
%               logaritmic units, possible options:
%                   'logx'
%                   'logy'
%                   'logxy'
%
% Output:

    
function pts = grabxy(fName, ax, logax)
% reads coordinates from raster image or image on the clipboard
%
% pts = GRABXY(fName, ax, {logax})
%
% Input:
%
% fName         String, path to the image file. If empty, the image is read
%               from the clipboard.
% ax            (x,y) coordinates of the three axis points, with dimensions
%               of 2x3. If ax is omitted or empty, GRABXY just shows the
%               image.
% logax         Optional input string, cn be used if the axis is in
%               logaritmic units, possible options:
%                   'logx'
%                   'logy'
%                   'logxy'
%
% Output:
%
% pts           Matrix, where the first row are the x coordinates the
%               second row is the y coordinates.
%
% How to use the function?
%
% You need an image where you know the coordinates of three points. These
% coordinates has to be given as the ax input to the grabxy() function.
% After calling the function, it shows the image file and the first three
% mouse clicks on the figure will determine the position of the three
% predefined points (shown as red circles) given in ax. Any other click
% afterwards will grab coordinates (shown as green circles). The coordinates
% of the green circles will be returned. If you don't want to grab more
% points, just right click anywhere on the figure.
%

if nargin == 0
    help grabxy
    return
end