Combine ascii files of different size

1 visualización (últimos 30 días)
PK
PK el 28 de Jul. de 2015
Respondida: Azzi Abdelmalek el 28 de Jul. de 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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by