开发者

export Matrix with this format MATLAB

开发者 https://www.devze.com 2023-02-15 13:05 出处:网络
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 \',\':

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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消