help changing subplot sequence in rdmseed

조회 수: 8 (최근 30일)
Ancalagon8
Ancalagon8 2024년 5월 10일
편집: Ancalagon8 2024년 6월 9일
How can i change the subplots sequence in rdmseed.m, while plotting a miniseed file with e.g. 5 stations?
function varargout = rdmseed(varargin)
if nargin > 6
error('Too many input arguments.')
end
% global variables shared with sub-functions
global f fid offset le ef wo rl forcebe verbose notc force
% default input arguments
makeplot = 0; % make plot flag
verbose = 0; % verbose flag/level
forcebe = 0; % force big-endian
ef = 10; % encoding format default
wo = 1; % word order default
rl = 2^12; % record length default
force = 0; % force input argument over blockette 1000 (UNDOCUMENTED)
notc = 0; % force no time correction (over ActivityFlags)
nullhead = 0; % allow null bytes before header
% sensible limits for multiplexed files
max_channels = 20; % absolute max number of channels to plot
max_channel_label = 6; % max. number of channels for y-labels
% file is opened in Big-Endian encoding (this is encouraged by SEED)
fid = fopen(f,'rb','ieee-be');
le = 0;
offset = 0;
% --- plots the data
if makeplot
figure
xlim = [min(cat(1,X.t)),max(cat(1,X.t))];
% test if all data records have the same length
rl = unique(cat(1,X.DataRecordSize));
if numel(rl) == 1
rl_text = sprintf('%d bytes',rl);
else
rl_text = sprintf('%d-%d bytes',min(rl),max(rl));
end
% test if all data records have the same sampling rate
sr = unique(cat(1,X.SampleRate));
if numel(sr) == 1
sr_text = sprintf('%g Hz',sr);
else
sr_text = sprintf('%d # samp. rates',numel(sr));
end
% test if all data records have the same encoding format
ef = unique(cellstr(cat(1,X.EncodingFormatName)));
if numel(ef) == 1
ef_text = sprintf('%s',ef{:});
else
ef_text = sprintf('%d different encod. formats',numel(ef));
end
if nc == 1
plot(cat(1,X.t),cat(1,X.d))
hold on
for i = 1:length(I.GapBlockIndex)
plot(I.GapTime(i),X(I.GapBlockIndex(i)).d(1),'*r')
end
for i = 1:length(I.OverlapBlockIndex)
plot(I.OverlapTime(i),X(I.OverlapBlockIndex(i)).d(1),'og')
end
hold off
set(gca,'XLim',xlim)
datetick('x','keeplimits')
grid on
xlabel(sprintf('Time\n(%s to %s)',datestr(xlim(1)),datestr(xlim(2))))
ylabel('Counts')
title(sprintf('mini-SEED file "%s"\n%s (%d rec. @ %s - %g samp. @ %s - %s)', ...
f,un{1},length(X),rl_text,numel(cat(1,X.d)),sr_text,ef_text),'Interpreter','none')
else
% plot is done only for real data channels...
if nc > max_channels
warning('Plot has been limited to %d channels (over %d). See help to manage multiplexed file.', ...
max_channels,nc);
nc = max_channels;
end
for i = 1:nc
subplot(nc*2,1,i*2 + (-1:0))
k = I(i).XBlockIndex;
if ~any(strcmp('ASCII',cellstr(cat(1,X(k).EncodingFormatName))))
plot(cat(1,X(k).t),cat(1,X(k).d))
hold on
for ii = 1:length(I(i).GapBlockIndex)
if ~isempty(X(I(i).GapBlockIndex(ii)).d)
D.BLOCKETTES.B1000.Reserved = fread(fid,1,'uint8');
end
  댓글 수: 5
David Goodmanson
David Goodmanson 2024년 5월 16일
It didn't run because there were several end statements missing at the bottom. After those were supplied, it doesn't run because of the statement fid = fopen(f,'rb','ieee-be') and nobody has that file.
Ancalagon8
Ancalagon8 2024년 5월 16일
편집: Ancalagon8 2024년 6월 9일
I attach an example .seed file. Please check it now and see if it runs correctly.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by