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 | |
---|
1 | function 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 |
---|
16 | DisplayFlag = 1; |
---|
17 | AbcissaUnit = 80; % 80us - range from 80us upto 100ms |
---|
18 | |
---|
19 | % Parse input options |
---|
20 | InputFlags = {}; |
---|
21 | for 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 |
---|
29 | end |
---|
30 | |
---|
31 | if isempty(varargin) |
---|
32 | [filename, pathname] = uigetfile({'*.bin'}, 'Pick a file'); |
---|
33 | filename = [pathname filename]; |
---|
34 | else |
---|
35 | filename= varargin{1}; |
---|
36 | if ~exist(filename,'file') |
---|
37 | error('Filename does not exist') |
---|
38 | end |
---|
39 | end |
---|
40 | |
---|
41 | fid = fopen(filename, 'r'); |
---|
42 | |
---|
43 | %Lit l'entete de 4 octets : nombre de points |
---|
44 | entete = fread(fid,1,'int32=>int32'); |
---|
45 | %% 12500 points (50 000 octets) : 4 octets en virgule flotante |
---|
46 | ramp = fread(fid,12500,'float32=>float32'); |
---|
47 | %% 4 octets de fin de fichiers |
---|
48 | fin = fread(fid,'float32=>float32'); |
---|
49 | fclose(fid); |
---|
50 | |
---|
51 | x = (0:12499)*AbcissaUnit*1e-6; |
---|
52 | |
---|
53 | if (DisplayFlag) |
---|
54 | plot(x,ramp) |
---|
55 | grid on |
---|
56 | title('Rampe Booster') |
---|
57 | xlabel('Time (s)') |
---|
58 | ylabel('Amplitude') |
---|
59 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.