How To Export a Matrix as a CSV File in MATLAB?
A CSV file – Comma Separated File, as the name suggests, is a file that stores data delimited by a ‘ , ‘. In MATLAB, there is a simple way of exporting a matrix to a csv file. The writematrix() function is used to write a matrix into any desired file type. The syntax is
This will create a new file in the current directory with the matrix stored in it. Let us see the same for csv files with various examples. Now, the following is a 2×5 matrix, and we will export it to a csv file named matrix.csv.
The created csv file:
Let’s export a 4×5 matrix with floating point data to csv file.
The new csv file would be:
My Personal Notes arrow_drop_up
Please Login to comment...