help changing subplot sequence in rdmseed

8 次查看(过去 30 天)
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