image thumbnail

Capture screen image Tektronix 2024B

by

 

Function will get data of channels that are ON and plots them.

get_scope_screen( )
function [ ] = get_scope_screen( )

% Roman Skrada
% Epoch Microelectronics
% This function will plot channel screen
% Good for getting screenshot without using the flash drive - should be
% faster and more convenient

% Set this global a level higher
global tds2024

% check what channels are ON

channel1_on = get(tds2024.Channel(1), 'State');
channel2_on = get(tds2024.Channel(2), 'State');
channel3_on = get(tds2024.Channel(3), 'State');
channel4_on = get(tds2024.Channel(4), 'State');

switch channel1_on
    case 'on'
    ch1=1;
    case 'off'
    ch1=0;
end

switch channel2_on
    case 'on'
    ch2=1;
    case 'off'
    ch2=0;
end

switch channel3_on
    case 'on'
    ch3=1;
    case 'off'
    ch3=0;
end

switch channel4_on
    case 'on'
    ch4=1;
    case 'off'
    ch4=0;
end

%get position for plotting
%get channel index for plot title

pos=0;

if ch1 == 1
    pos = pos+1;      %get position for plotting
    name(pos)=1;      %get channel index for plot title
    [x,y(:,pos)]=get_scope_channel(1);
end

if ch2 == 1
    pos = pos+1;
    name(pos)=2;
    [x,y(:,pos)]=get_scope_channel(2);
end

if ch3 == 1
    pos = pos+1;
    name(pos)=3;
    [x,y(:,pos)]=get_scope_channel(3);
end

if ch4 == 1
    pos = pos+1;
    name(pos)=4;
    [x,y(:,pos)]=get_scope_channel(4);
end

% Now plot all on one plot
% First see how many channels are ON
 
count_on = ch1+ch2+ch3+ch4;

%adjust the x-axis data so it starts from zero
x = x + abs(min(x));

figure;
for position = (1 : 1 : count_on)
    
    subplot(count_on,1,position);
    plot(x,y(:,position));
    text(min(x)+max(x)/50,max(y(:,position))/2,['min=',num2str(min(y(:,position)))],'FontSize',12,'BackgroundColor',[1 1 1])
    text(min(x)+max(x)/50,max(y(:,position))/3,['max=',num2str(max(y(:,position)))],'FontSize',12,'BackgroundColor',[1 1 1])
    text(min(x)+max(x)/50,max(y(:,position))/6,['avg=',num2str(mean(y(:,position)))],'FontSize',12,'BackgroundColor',[1 1 1])
    title(['Channel ',num2str(name(position))]);
    ylabel('Volts');
    grid on
    hold on
    
end

xlabel('Seconds');

Contact us