I need to make a .txt file on the format as shown below.
_____________________________________________________________
Node coordinates and Elements
Coordinates
1.0000 50.0000 20.5000 20.0000
2.0000 50.0000 20.5000 -20.0000
3.0000 50.0000 20.5000 6.6667
4.0000 50.0000 20.5000 -6.6667
5.0000 -50.0000 20.5000 -20.0000
6.0000 37.5000 20.5000 -20.0000
7.0000 25.0000 20.5000 -20.0000
8.0000 12.5000 20.5000 -20.0000
9.0000 0 20.5000 -20.0000
10.0000 -12.5000 20.5000 -20.0000
End Coordinates
Elements
1 27 32 33
2 27 26 32
3 24 29 30
4 24 23 29
5 37 36 34
6 37 3 36
7 39 35 14
8 39 29 35
End Elements
_______________________________________________________________________________
I've made following strings and doubles to assemble as above.
Header = 'Node coordinates and Elements';Nstart = 'Coordinates\n';Nend = 'End Coordinates\n';Space = ' \n';Estart = 'Elements\n ';Eend = 'End Elements';A = [1,50,20.5000000000000,20;2,50,20.5000000000000,-20;3,50,20.5000000000000,6.66666666666670;4,50,20.5000000000000,-6.66666666666670;5,-50,20.5000000000000,-20;6,37.5000000000000,20.5000000000000,-20;7,25,20.5000000000000,-20;8,12.5000000000000,20.5000000000000,-20;9,0,20.5000000000000,-20;10,-12.5000000000000,20.5000000000000,-20]B = [1,27,32,33;2,27,26,32;3,24,29,30;4,24,23,29;5,37,36,34;6,37,3,36;7,39,35,14;8,39,29,35]
I tried fprint or dlmwrite, but only either the string or the doubles work. I've also tried converting the doubles to string, but unsuccessfully.
Best Answer