from Make MATLAB Talk by Sam Roberts
Make MATLAB Talk

saydemo.m
%% Make MATLAB talk, second better attempt

%%
% I submitted a sharedemo previously that made MATLAB talk by using Excel.

type say_old

%%
% This was a hack, and Elwin Chan pointed out to me that this could be done
% better through a Windows API call.

type say

%%
% This API call has the advantage of multiple voices.

say('I love MATLAB')

myResult = 2+3;

say(['The answer is ',num2str(myResult)],'LH Michelle');

say('Your distributed job is complete, master')

say(['The time is now',datestr(now,'HH:MM')],'LH Michelle')

say('Shut up')

say('No, you shut up','LH Michelle')

say('Both of you shut up','Microsoft Sam')

Contact us at files@mathworks.com