Combine ascii files of different size

1 Ansicht (letzte 30 Tage)
PK
PK am 28 Jul. 2015
Beantwortet: Azzi Abdelmalek am 28 Jul. 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

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 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']

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by