MATLAB: Does this not make and save a text file

MATLABsavetext file

I'm trying to save a string to a text file. My end goal is to be able to create a file called CLIP.XML populated with the text
"<XML>
< /XML>"
I've added a space to force it not to make a link. However, I can't even seem to get anything to write as a text file. My code is shown below.
dataLoc = 'C:\Users\e370305\Desktop\Databases\Test 1';
text = 'XML';
fileLoc = fullfile(dataLoc,'\CLIPPING\CLIPPINGINDEX.txt');
fid = fopen(fileLoc);
fprintf(fid,text);
fclose(fid);
It's not actually generating any file at all. And when the file exists, it doesn't modify it. Is it the way I'm specifying the location or something else?

Best Answer

fid = fopen(fileLoc, 'w');
% ^^^
Otherwise the file is opened for reading only, not for writing.