How to convert grid file to text file?

2 visualizaciones (últimos 30 días)
hanif hamden
hanif hamden el 28 de Jun. de 2020
Editada: Walter Roberson el 5 de Jul. de 2020
Hi there.
Can you help me on how to convert this type of grid file into text file (lat, lon, amp, phase) for each column.
The grid file is attached

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Jun. de 2020
fid = fopen('Example.txt');
data = cell2mat(textscan(fid, '', 'HeaderLines', 5));
fclose(fid);
amps = data(1:2:end,:);
phases = data(2:2:end,:);
[nr, nc] = size(amps);
longs = linspace(0, 360, nc+1);
longs(end) = [];
lats = linspace(-90, 90, nr+1);
lats(end) = [];
subplot(2,1,1);
surf(longs, lats, amps);
xlabel('long')
ylabel('lat')
title('amplitudes')
subplot(2,1,2)
surf(longs, lats, phases)
xlabel('long')
ylabel('lat')
title('phases')
  9 comentarios
hanif hamden
hanif hamden el 29 de Jun. de 2020
Thank you so much sir!! :)
hanif hamden
hanif hamden el 5 de Jul. de 2020
Editada: Walter Roberson el 5 de Jul. de 2020

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by