1 | function res=idPlotCorrectionCurrents(FFWDTableStructure, idName, CorrectorName, idMode, FixedParameter, FixedValue, Format, NewPlot) |
---|
2 | % Written by F. Briquez 03/11/2010. |
---|
3 | % Modified 22/07/2011 => Uses FFWD table structure |
---|
4 | % Allows 1D plot in addition to 2D plot |
---|
5 | % Modified 13/09/2011 => possibility to enter directly FFWDTableStructure |
---|
6 | % (then doesnt't take into account idName, CorrectorName and idMode) |
---|
7 | |
---|
8 | % 18/10/2011 : It doesn't work anymore!!!! |
---|
9 | res=-1; |
---|
10 | |
---|
11 | if (isempty(FFWDTableStructure)) |
---|
12 | FFWDTableStructure=idDownloadFFWDTableStructureOfOneCorrectorFromDevice(idName, CorrectorName, idMode); |
---|
13 | end |
---|
14 | Table=FFWDTableStructure.Table; |
---|
15 | vGaps=FFWDTableStructure.vGaps; |
---|
16 | vPhases=FFWDTableStructure.vPhases; |
---|
17 | |
---|
18 | vPhases=transpose(vPhases); |
---|
19 | vGaps=transpose(vGaps); |
---|
20 | |
---|
21 | if (NewPlot~=0) |
---|
22 | figure(NewPlot); |
---|
23 | clf |
---|
24 | end |
---|
25 | hold on; |
---|
26 | |
---|
27 | if isempty(FixedParameter) |
---|
28 | vPhases=transpose(vPhases); |
---|
29 | [vPhases, vGaps]=meshgrid(vPhases, vGaps); |
---|
30 | surfl(vGaps, vPhases, Table); |
---|
31 | LegendText=CorrectorName; |
---|
32 | |
---|
33 | else |
---|
34 | if strcmpi(FixedParameter, 'phase')&&~isempty(FixedValue) |
---|
35 | PhaseIndex=idAuxFindClosestElemInd(FixedValue, vPhases); |
---|
36 | if (PhaseIndex==-1) |
---|
37 | fprintf ('Wrong FixedValue input\n'); |
---|
38 | return |
---|
39 | end |
---|
40 | FixedValue=vPhases(PhaseIndex); |
---|
41 | vX=vGaps; |
---|
42 | vY=Table(:, PhaseIndex); |
---|
43 | elseif strcmpi(FixedParameter, 'gap')&&~isempty(FixedValue) |
---|
44 | GapIndex= idAuxFindClosestElemInd(FixedValue, vGaps); |
---|
45 | if (GapIndex==-1) |
---|
46 | fprintf ('Wrong FixedValue input\n'); |
---|
47 | return |
---|
48 | end |
---|
49 | FixedValue=vGaps(GapIndex); |
---|
50 | vX=vPhases; |
---|
51 | vY=Table(GapIndex, :); |
---|
52 | else |
---|
53 | fprintf ('Wrong attributes\n'); |
---|
54 | return |
---|
55 | end |
---|
56 | LegendText=[CorrectorName '@ ' FixedParameter '=' num2str(FixedValue) ' mm']; |
---|
57 | if isempty(Format) |
---|
58 | plot (vX, vY) |
---|
59 | else |
---|
60 | plot (vX, vY, Format) |
---|
61 | end |
---|
62 | end |
---|
63 | legend (LegendText); |
---|
64 | hold off |
---|
65 | res=1; |
---|
66 | return |
---|
67 | end |
---|
68 | |
---|