Question: I am working with Google Maps API V3 to calculate all the possible routes from a given Source to the specified Destination. For this I takes the Destination and Source as inputs from the user and pass these values in the request with option provideRouteAlternatives: true. I am successful in calculating different Routes and also marking i.e. displaying them on my Map.

Now I am wondering if it is possible to name the Different Routes. By naming the Routes I mean adding a small description to each Route like the Street Name etc. which that particular route takes while moving from Source to Destination. I want to do this so as to make it look more interactive. For example if there are 3 Routes possible from location A (Arizona Street, San Diego, CA, USA) to location B (Fenton Parkway, San Diego, CA 92108, USA) then instead of showing results like Route 1, Route 2, Route 3 it should show the Street names like "Texas St & Rio San Diego Dr", "Texas St & Friar Rd", "Friars Rd".

I am able to calculate all the other things like the trip distance and total trip time for each of my Route but have no clue to how to add this description to each of my Route.

Any help will be appreciated.

Thanks

Answer: 
Have you looked into [string formatting](http://www.mathworks.com/help/matlab/matlab_prog/formatting-strings.html)?

```
fid = fopen( 'myFile.txt', 'w' );
for ii=1:size(cloud,1)
    fprintf( fid, '%.5g\t%.5g\r\n', cloud(ii,1), cloud(ii,2) );
end
fclose( fid ); % do not forget to close the file :-)

```

Have you considered [`save`](http://www.mathworks.com/help/matlab/ref/save.html)ing into ascii file?

```
save( 'myFile.txt', 'cloud', '-ascii', '-tabs' );

```

**EDIT:** 

1. 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 `\r` and 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)
2. Accuracy: the number in the formatting string `%.5g` determines the accuracy of the printed number. Again, you can play with it till you are satisfied with the results.
WINDOWS
-------

Here's one way: 

```
fid = fopen('cloud.txt', 'w');    
fprintf(fid, '%.4f\t%.4f\r\n', cloud.');
fclose(fid)

```

Here's the more readable way: 

```
dlmwrite('cloud.txt', cloud, 'delimiter', '\t', 'precision', 4, 'newline', 'pc')

```

LINUX
-----

Here's one way: 

```
fid = fopen('cloud.txt', 'w');    
fprintf(fid, '%.4f\t%.4f\n', cloud.');
fclose(fid)

```

Here's the more readable way: 

```
dlmwrite('cloud.txt', cloud, 'delimiter', '\t', 'precision', 4);

```