MATLAB: Set the SamplesAcquiredFcn property

samplesacquiredfcn property

I am trying to acquire voice through sound port but am getting the following warning.
Warning: The SamplesAcquiredFcn callback is being disabled. To enable the callback, set the SamplesAcquiredFcn property.
kindly suggest how to set the SamplesAcquiredFcn property.
Also if i want to record and display voice in real time how can i do that. Moreover i also want to extract 2sec data & process it and then again exract 2 sec data do the same processing as the voice continuously keeps on recording.
Anybody please help. Thanks.