source: MML/trunk/machine/SOLEIL/Booster/readramp3Hz.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.3 KB
Line 
1function ramp = readramp3Hz(varargin)
2%READRAMP3HZ - Read a binary ramp input file for SLS 3Hz Powersupplies
3%
4% INPUTS
5% 1. Filename {optional}
6%
7% OUPUTS
8% 1. Ramp - Booster ramp read from binary file
9%
10% See also write_ramp3Hz
11
12%
13% Written by Laurent S. Nadolski
14
15%% Default flags
16DisplayFlag = 1;
17AbcissaUnit = 80; % 80us - range from 80us upto 100ms
18
19% Parse input options
20InputFlags = {};
21for i = length(varargin):-1:1
22    if strcmpi(varargin{i},'Display')
23        DisplayFlag = 1;
24        varargin(i) = [];
25    elseif strcmpi(varargin{i},'NoDisplay')
26        DisplayFlag = 0;
27        varargin(i) = [];
28    end
29end
30
31if isempty(varargin)
32    [filename, pathname] = uigetfile({'*.bin'}, 'Pick a file');
33    filename = [pathname filename];
34else
35    filename= varargin{1};
36    if ~exist(filename,'file')
37        error('Filename does not exist')
38    end
39end
40
41fid = fopen(filename, 'r');
42
43%Lit l'entete de 4 octets : nombre de points
44entete = fread(fid,1,'int32=>int32');
45%% 12500 points (50 000 octets) : 4 octets en virgule flotante
46ramp = fread(fid,12500,'float32=>float32');
47%% 4 octets de fin de fichiers
48fin  = fread(fid,'float32=>float32');
49fclose(fid);
50
51x = (0:12499)*AbcissaUnit*1e-6;
52
53if (DisplayFlag)
54    plot(x,ramp)
55    grid on
56    title('Rampe Booster')
57    xlabel('Time (s)')
58    ylabel('Amplitude')
59end
Note: See TracBrowser for help on using the repository browser.