The function "avifile" will be removed in a future release of Matlab. It is replaced with "VideoWriter" by the official  suggestion.