I have an array which looks like this:
cloud =
7.5059 51.4406
7.5057 51.4445
7.5048 51.4484
7.5034 51.4522
7.5014 51.4558
7.4989 51.4593
7.4958 51.4627
7.4923 51.4658
7.4884 51.4686
.
.
all i want is to write this array to a text file as it is, in the same format. I tried both fprintf and dlmwritebut i’m able to produce the exact same format. I know its an easy one, but I’m only asking after trying a lot.
Have you looked into string formatting?
Have you considered
saveing into ascii file?EDIT:
End-of-line issue: for text file there are several way of marking the end of line: On windows it is usually required to print
\r\n, for Mac and Linux sometimes it is enough to use\rand sometimes\n(I’m not 100% sure). So, you might need to experiment with it a bit to find out what works best for your machine. (Thanks @Rody for correcting me here)Accuracy: the number in the formatting string
%.5gdetermines the accuracy of the printed number. Again, you can play with it till you are satisfied with the results.