MATLAB: How to stop a function from displaying output matrix without using semicolon in command window

function

Here is one of my functions for color histogram equalization:
function [ newimg ] = oldhist( img );
Red = img(:,:,1);
Green = img(:,:,2);
Blue = img(:,:,3);
R = histeq(Red);
G = histeq(Green);
B = histeq(Blue);
newimg= cat(3,R,G,B);
imshow (newimg);
end
If I use it without a semicolon in the command window it will display the newimg matrix. How do I store newimg matrix without displaying the matrix and without using a semicolon in the command window?

Best Answer

Try using
function varargout =
instead of
function newimg =