⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fvslsgn.m

📁 密歇根大学的ECG(心电图)检测结果数据库
💻 M
字号:
function fvslsgn(direction);
%function fvslsgn(direction);
% This function was designed to display the signal
% together with its respective annotation
%   direction= positive (normal direction, that is, towards future)
%              negative (past ones)
% Integral part of vqrs.m

   global patient pos_sgn tam_sgn T fs fid_ant;

   global eixo1  eixo2  
   
   global canal0 canal1; % Needed fbufsgn(direction)
   
   fbufsgn(direction);
   fseek(fid_ant,0,'bof');
   [I,A]=fbufant(1);
   

   if isempty(canal0)
      return
   end

   % Writing annotation on displayed signals
   % inicio= position of beginning of signal in number of samples
   % fim = position of end of signal in number of samples
   inicio=pos_sgn-length(canal0)-1;
   fim= pos_sgn;
   
   while 1,%(I(1)>inicio) % Finding beginning of buffer that contains this segment
      if I(1)<=inicio
         break
      else
         [I,A]=fbufant(-1);
         if isempty(I)     % Indicates that we are at beginning of file
            fseek(fid_ant,0,'bof');
            [I,A]=fbufant(+1);
            break;
         end
      end
   end
   i=1;
   ritmo_t=[];
   class_t=[];
   ritmo=[];
   class=[];
   while (I(i)<=fim)
      if I(i)>=inicio
         if (A(i)==14|A(i)==16|A(i)==18|A(i)==19|A(i)==22|A(i)==26|A(i)==28|A(i)==31|A(i)==32|A(i)==33|A(i)==37|A(i)==39|A(i)==40)
            ritmo_t=acrsmtr(ritmo_t,I(i)*T);
            ritmo=acrsmtr(ritmo,A(i));
         else
            class_t=acrsmtr(class_t,I(i)*T);
            class=acrsmtr(class,A(i));
         end 
      end
      if I(length(I))< inicio
         i=length(I);
      end
      if i==length(I)
         [I,A]=fbufant(+1);
         if isempty(I)
            break
         end
         i=1;
      else
         i=i+1;
      end 
   end
  
   t=((pos_sgn-length(canal0)):(pos_sgn-1))*T;

   %Show graphic response
   set(eixo1,'color',[1 1 1],'position',[0.05 0.52 0.93 0.40]);
   set(eixo2,'color',[1 1 1],'position',[0.05 0.11 0.93 0.40]);
   for cont=1:2,
      if cont==1,
         axes(eixo1)
         plot(t,canal0,'b');
         hold on, 
         plot(t,canal0,'b'); % Re-do to put on top 
         hold off
         title(fsg2time(pos_sgn*T),'color',[0 0 0]);
         ylabel('channel 0 (mV)');
         set(eixo1,'xticklabel',[]);
   
      else
         axes(eixo2)
         plot(t,canal1,'b');
         hold on, 
         plot(t,canal1,'b'); % Re-do to put on top 
         hold off
         ylabel('channel 1 (mV)');
         xlabel('seconds');
      end
      save channel0 canal0;
      save channel1 canal1;
      
      eixos=axis;
      axis([min(t),max(t),eixos(3),eixos(4)]);
      
      
      if length(class)~=0,
         hold on
         plot(class_t,(eixos(4)-((eixos(4)-eixos(3))/5))*ones(size(class_t)),'*r');
         for i=1:length(class),
            text('position',[class_t(i)+10*T,eixos(4)-((eixos(4)-eixos(3))/5)],'string',sprintf('%d',class(i)),'color',[0 0 0]);
         end
         hold off
      end
      if length(ritmo)~=0,
         hold on
         plot(ritmo_t,(eixos(4)-((eixos(4)-eixos(3))/7))*ones(size(ritmo_t)),'*c');
         for i=1:length(ritmo_t),
            text('position',[ritmo_t(i)+10*T,eixos(4)-((eixos(4)-eixos(3))/7)],'string',sprintf('%d',ritmo(i)),'color',[0 0 0]);
         end
         hold off
      end 
      % set(eixo1,'xcolor',[0 0 0])
      % set(eixo1,'ycolor',[0 0 0])
      % set(eixo1,'xgrid','on');
      
      grid on;
   end
   %Changing grid colours
   set(eixo1,'xcolor',[0 0 0]);
   set(eixo1,'ycolor',[0 0 0]);
   
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -