MATLAB: How to put a vector in a file

filetext filetxtvector

I'd like to create a vector from 1 to 744 (vertically) and put that in a file .txt
1
2
3
..
..
744
Thanks

Best Answer

[fid,msg] = fopen('filename.txt','wt');
assert(fid>=3,msg)
fprintf(fid,'%d\n',1:744)
fclose(fid);
Or
V = 1:744;
dlmwrite('filename.txt',V(:),'newline','pc')