You can use dlmwrite to write an array into a text file and specify the delimiter or use fprintf to have more control about the formatting of the output.
A csv file is a ascii ("txt") file with comma as delimiter (comma separated values) and usually the file extension "csv".