Hi, how do i import a text file as column vectors?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lukman Daud
am 24 Mär. 2019
Beantwortet: madhan ravi
am 24 Mär. 2019
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
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 24 Mär. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Seismology 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!