function RGB = insertText (img, pos, txt)
   hf = figure ("visible", "off");  # Invisible figure for combining images
   imshow (img);                      # Add image
   text (pos(:,1), pos(:,2), txt);  # Add text
   RGB = print (hf, "-RGBImage");   # Extract new image
   close (hf);                      # cleanup temporary figure
 endfunction