Combine ascii files of different size

1 vue (au cours des 30 derniers jours)
PK
PK le 28 Juil 2015
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

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 28 Juil 2015
Lon= [-180 10]
Lat= [-90 0 60]
Depth= [1 2 3 4 5 6]
[ii,jj]=ndgrid(Lon,Lat);
out=[ii(:) jj(:) Depth']

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by