How to convert grid file to text file?

조회 수: 2 (최근 30일)
hanif hamden
hanif hamden 2020년 6월 28일
편집: Walter Roberson 2020년 7월 5일
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

채택된 답변

Walter Roberson
Walter Roberson 2020년 6월 28일
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
hanif hamden
hanif hamden 2020년 6월 29일
Thank you so much sir!! :)
hanif hamden
hanif hamden 2020년 7월 5일
편집: Walter Roberson 2020년 7월 5일

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by