# load_scope

## PURPOSE

## SYNOPSIS

function load_scope(files,refresh_rate,sample_frequency)

## DESCRIPTION

## CROSS-REFERENCE INFORMATION

This function calls:

- close VR=CLOSE(VR)
- close VW=CLOSE(VW)
- close VR=CLOSE(VR)
- close VW=CLOSE(VW)
- close VR=CLOSE(VR)
- close VW=CLOSE(VW)
- start_display

This function is called by:

## SOURCE CODE

    0001 function load_scope(files,refresh_rate,sample_frequency)
    0002 close all
    0003 shot_size=round(sample_frequency/refresh_rate);
    0004 ring=zeros(shot_size*20,1)';
    0005
    0006 fig = figure('Position',[500,500,800,600],...
    0007         'NumberTitle','off',...
    0008         'Name','Scope',...
    0009         'doublebuffer','on',...
    0010         'HandleVisibility','on',...
    0011     'Renderer', 'openGL');
    0012
    0013 plot_ref=plot(zeros(10,1));
    0014
    0015
    0016 for i=1:length(files)
    0017     %files{i};
    0018     fid=fopen(files{i},'r');
    0019     fseek(fid,0,1);
    0020     e_o_f=ftell(fid);
    0021     fseek(fid,0,-1);
    0022
    0023
    0024     while (ftell(fid)<e_o_f)
    0025         tic
    0026         [data,c]=fread(fid,shot_size,'short');
    0027         data=(data/10000)';
    0028         %data=rand(1,length(data));
    0029         ring=[ring data];
    0030         ring(1:length(data))=[];
    0031         start_display(ring,plot_ref);
    0032         stop_time=toc;
    0033         while stop_time<(1/refresh_rate)
    0034             stop_time=toc;
    0035
    0036         end
    0037     end
    0038     fclose(fid)
    0039
    0040 end
    0041
    0042