MATLAB: Print an array to .txt

arrayMATLABsave totxt

Didn't find a good explanation.
Suppose we have an array R=[..,..,..] How to save this single array to a .txt file? Thank you.

Best Answer

Vadim - try using fprintf. For example,
% open your file for writing
fid = fopen('myTextFile.txt','wt');
% write the matrix
myData = randi(255,10,3);
if fid > 0
fprintf(fid,'%d %d %d\n',myData');
fclose(fid);
end
The above is a very simple example that is based on the examples in the provided link so see that link for more details.
Related Question