Hi, how do i import a text file as column vectors?

조회 수: 5 (최근 30일)
Lukman Daud
Lukman Daud 2019년 3월 24일
답변: madhan ravi 2019년 3월 24일
Hello, im trying to plot receiver station distributions for an earthquake. In order to do this, I need to import the data from a text file as column vectors. How do i go about doing this?
I have included the code and the text file.
Text file:
ARU LHZ 41.6 56.1
BFO LHZ 55.3 26.2
EFI LHZ 200.1 93.6
ESK LHZ 32.4 22.9
JTS LHZ 259.8 60.4
KIV LHZ 60.2 50.1
NNA LHZ 235.7 69.5
SACV LHZ 177.4 22.6
ANTO LHZ 68.4 44.2
COLA LHZ 337.5 68.6
DWPF LHZ 276.1 48.0
KBS LHZ 9.5 43.9
KEV LHZ 23.9 42.1
LVC LHZ 222.5 73.0
PAB LHZ 76.7 16.0
PET LHZ 358.0 89.6
SDV LHZ 247.5 50.4
SFJD LHZ 341.5 32.9
SJG LHZ 253.5 41.1
TIXI LHZ 8.7 69.3
TSUM LHZ 137.1 69.1
and here is the code to plot the figure:
%% Plot station distribution
% Import 'Stations.txt' data as individual column vectors
figure;
h = polar(deg2rad(azi(1:1:end)),dis(1:1:end),'^');
hold on
set(h,'markersize',9,'MarkerFaceColor','b')
xlabel('Distance from epicenter / Degrees')
ylabel('Azimuth from the North / Degrees')
title('Station Distribution')
view(90,-90)
h = polar(0,0,'pr');
set(h,'markersize',15,'MarkerFaceColor','r')
hold off
thanks

채택된 답변

madhan ravi
madhan ravi 2019년 3월 24일
I have no idea what you are doing but see if this atmost cares your needs:
T = readtable('Stations.txt');
T{:,3} % to access third column , likewise apply it to the rest

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Seismology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by