%% Display Vector, Complex, and Enumerated Signals
% Define a |WeekDaysInt| class to hold an enumerated list of weekday
% values. Create and save the following class definition file.

%%
%
%   classdef WeekDaysInt < int32
%     enumeration
%       Monday(1), Tuesday(2), Wednesday(3), Thursday(4), Friday(5)
%     end
%   end

%%
% Create a |dsp.LogicAnalyzer| object and configure the vector, complex, 
% and enumerated data signals.

scope = dsp.LogicAnalyzer('NumInputPorts',6);
waves = getDisplayChannelTags(scope);

modifyDisplayChannel(scope,waves{1},'InputChannel',1,'Name','Vector Digital');      
modifyDisplayChannel(scope,waves{2},'InputChannel',2,'Name','Vector Analog',...
    'Format','Analog','Height',80);  
modifyDisplayChannel(scope,waves{3},'InputChannel',3,'Name','Complex Digital');      
modifyDisplayChannel(scope,waves{4},'InputChannel',4,'Name','Complex Analog',...
    'Format','Analog','Height',80,'Color','Green'); 
modifyDisplayChannel(scope,waves{5},'InputChannel',5,'Name','Enum Digital');      
modifyDisplayChannel(scope,waves{6},'InputChannel',6,'Name','Enum Analog',...
    'Format','Analog','Height',80); 

%%
% Call the scope object in a loop to display the signals.

stop = 30;
for count = 1:stop
    sinValVec       = sin(count/stop*2*pi);
    cosValVec       = cos(count/stop*2*pi);
    cosValVecOffset = cos((count+10)/stop*2*pi);
    sinValReal      = sin((count+2)/stop*2*pi);
    cosValImag      = cos((count+2)/stop*2*pi);

    % Create a weekday enumerated value by wrapping the index
    day = WeekDaysInt(1+mod(count-1,5));
    
    scope(...
          [count (count-(stop/2))],...              % digital vector
          [sinValVec cosValVec cosValVecOffset],... % analog vector
          complex((count-(stop/2)),count),...       % digital complex 
          complex(sinValReal, cosValImag),...       % analog complex
          day,...                                   % digital enum
          day...                                    % analog enum
          )
end

%%
% <<../DisplayVectorsComplexAndEnumeratedSignalsGraphic.png>>






%% 
% Copyright 2012 The MathWorks, Inc.