Bonjour,

Je souhaite couper une courbe et n'afficher que ce qu'il y a avant, a partir d'une certaine valeur dans mes valeurs en abscisses, d'un plot generé par un GUI en appuyant sur un pushbutton.

Le probleme c'est que matlab m'affiche quand meme toute la courbe. Pourtant, lorsque je génere ce plot normalement (via l'éditeur), il n'y a aucun soucis.

Voici mon code (s est la variable a partir de laquelle sera coupé ma courbe, et est deja calculé préalablement) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
% --- Outputs from this function are returned to the command line.
function varargout = Plot_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
% Get default command line output from handles structure
varargout{1} = handles.output;
 
function LocSetLimits(ax,lims)
set(ax,'XLim',lims(0:s),'XLimMode','manual');
 set(ax,'view',[0 s]);
 
% --- Executes on button press in plot.
function plot_Callback(hObject, eventdata, handles)
% hObject    handle to plot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global fvar;
global G;
global fmax;
global ABS;
global s;
 
s=fmax+150;
 
plot (fvar,G),hold on,title 'Sound absorption coefficient', xlabel 'Frequency (Hz)', ylabel 'Amplitude';
Je ne comprends pas ce qui cloche, pouvez vous m'éclairer svp ?

Merci d'avance.