edgarmtze
edgarmtze

Reputation: 25058

export Matrix with this format MATLAB

How to export any size matrix like

A=
1 2 3 4 5 6 ....9
3 6 7 8 9 9 ....4
...
6 7 7 4 4 5 ... 2

To a file that will contain that matrix where each value is separated by ',':

1, 2, 3, 4, 5, 6, ....,9
3, 6, 7, 8, 9, 9, ....,4
...
6, 7, 7, 4, 4, 5, ... ,2

Upvotes: 2

Views: 119

Answers (1)

b3.
b3.

Reputation: 7175

Use DLMWRITE. Doing this:

>> A = [1 2 3 4; 5 6 7 8];
>> dlmwrite('file.csv', A);

writes a file with this:

1,2,3,4
5,6,7,8

Upvotes: 3

Related Questions