matrix manipulation

1 次查看(过去 30 天)
gianluca
gianluca 2012-4-18
Hi, I've an ASCII file like this
450 1 2 3 4 5
6 7 8 9 10 11
12 13
451 1 2 3 4 5
6 7 8 9 10 11
12 13
452 1 2 3 4 5
6 7 8 9 10 11
12 13
...
and I would modify it to obtain a file like this
450 1 2 3 4 5 6 7 8 9 10 11 12 13
451 1 2 3 4 5 6 7 8 9 10 11 12 13
452 1 2 3 4 5 6 7 8 9 10 11 12 13
Any suggestions? Thanks Gianluca

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-4-18
f = fopen('test.txt');
c = textscan(f,'%f');
fclose(f);
out = reshape(c{:},[],3)'

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by