Combine ascii files of different size
1 view (last 30 days)
Show older comments
Hi everybody. I am rather new in Matlab hope that someone can provide me help or a link with a probably very naive question. I have three different files (longitude, latitude and depth). The files have different sizes but the same format. I want to combine them to a single file. I give a simple example. Lon= -180 10 Lat= -90 0 60 Depth= 1 2 3 4 5 6
At the end I want to have something like this: lon lat depth -180 -90 1 10 -90 2 -180 0 3 100 0 4 -180 60 5 10 60 6
My files are much larger. I have more files thats why I need kind of an automatised way.
I thought that I probably should make use of loops. I would be happy about any hint.
Cheers PK
0 Comments
Accepted Answer
Azzi Abdelmalek
on 28 Jul 2015
Lon= [-180 10]
Lat= [-90 0 60]
Depth= [1 2 3 4 5 6]
[ii,jj]=ndgrid(Lon,Lat);
out=[ii(:) jj(:) Depth']
0 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!