deviceWriter is more complex to use as it plays only one frame. It means you have to use it in a loop. You also don't need the code in the last line. Rather then using deviceWriter, why not using audioPlayer?
fs = 44100;
T = 1/fs;
t = [0:T:1];
f1 = 250;
omega1 = 2*pi*f1;
phi = 2*pi *0.75;
x1 = cos(omega1*t +phi)';
info = audiodevinfo
player = audioplayer(0.9*x1, fs, 16, 3);
play(player);
You can explore the info.output variable to see the list of detected hardware.