Read Miniseed Data File
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I am trying to read and plot miniseed data file and I have three different codes that are related to each other. When I run the code calling the others, I get an error "Undefined variable Aname.
Error in ==> ReadingSOSEdata at 75
data=rdmseed(Aname(1,:)); %read miniseed file"
Also, the code is below;
clear
clc
close all
warning off
origpath=pwd;
% name input file with information
nameinput='input_readSOSE.txt';
%%%%%%%%%%PARAMETERS %%%%%%%%%%
sampling=100; % sampling rate
dt=1./sampling;
% ADC constant count-2-volts = 10V/2^24C
C2VSN=2^24/5; % I test 19 Bits as effective resolution for the new AD-board
% parameters for the SOSEWIN instrument transfer function (4.5 Hz geophone used)
p = [-22.60000000+17.00000000*i;-22.60000000-17.00000000*i];
z = [0;0];
G=27; % generator constant for the geophone
% convention SOSEWIN New + 4.5 Geophone
% ENE => vertical
% ENZ => NS
% ENN => EW
root1='.SW..';
root2='.D.2010.';
%%%%%%%%%
% 1 %
% reading the input file %
[numsta,itbm,itbh,ncomp,pathmio]=readSOSE(nameinput,sampling);
resupath=['Resu' (pathmio)];
% LOADING THE DATA
cd ('C:\Users\asus\Documents\MATLAB\GFZ_Airport-Hill-b1-S3-top-back')
a=ls; a(1:2,:)=[];
%%%%%%%%%%%%%%%%%%%%
bbb=a(:,11:13); % component
ncomp(4:5)=[]; % selected component
[ix]=strmatch(ncomp,bbb,'exact'); % componente
bb=[num2str(itbh) num2str(itbm)]; %
ic=0;
for io=length(ix):-1:1
% a(ix(1):ix(end),end-3:end) % time
if str2num(a(ix(io),end-3:end))<str2num(bb) & ic==0
Aname(1,:)=a(ix(io),:);
ic=1;
end
end
% reading the data with rdmseed
data=rdmseed(Aname(1,:)); %read miniseed file
signal=cat(1,data.d);
npt=length(signal);
timeZ=data(1,1).RecordStartTimeISO;
%
clear DATA
DATA(:,1)=signal;
DATA(:,1)=DATA(:,1)./(10*C2VSN);
clear signal
%end of the reading part, DATA is the vector
cd (origpath)
status = fclose('all');
% here it checks if the folder exists. If not, it is created
Foldchk= exist (resupath);
if Foldchk==7
cd (resupath)
elseif Foldchk==0
mkdir (resupath)
cd (resupath)
end
plot (DATA)
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
What can be the reason for getting such an error?
0 Kommentare
Antworten (1)
Walter Roberson
am 2 Jul. 2012
You do not initialize Aname before your loop "for io=length(ix):-1:1" and that loop only initializes Aname conditionally, with a condition that is not certain to be met (at least not in any obvious manner.)
Side note: "." and ".." will not always appear first and second in the output of "ls"
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Import and Analysis 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!