la fonction spline dans l'interface
salut tout le monde,
voici mon problème, j'ai essayé de lisser des courbes avec la fonction spline à partir de l'interface, et voilà que je reçois le message suivant :
Citation:
??? Error using ==> rdivide
Integers can only be combined with integers of the same class, or
scalar doubles.
Error in ==> spline at 60
dd = ones(yd,1); dx = diff(x); divdif = diff(y,[],2)./dx(dd,: );
Error in ==> projet>buttontraitement_Callback at 294
yy=spline(t,handles.(sprintf('intensitePixel%d',i)),xx);
??? Error while evaluating uicontrol Callback
je signale que j'ai déjà utilisé la fonction spline dans un script
exemple :
Code:
1 2 3 4 5 6
| %------------------------------------------------------------------------
t=(0.8/6):(0.8/6):0.8;
v=[1 5 2 3 6 4];
xx=(0.8/6):(0.2/6):0.8;
yy=spline(t,v,xx);
%------------------------------------------------------------------------ |
et cela a bien marcher, mais apparemment il y' a un problème quand c'est fait à partir d'une des fonctions de l'interface, surtout que l'équivalant du vecteur v dans l'exemple est un élément d'une structure (handles.intensitePixel).
voici le code source:
Code:
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 29 30 31 32 33
| %------------------------------------------------------------------------
function bouttontraitement_Callback(gcf, event_data, handles)
handles = guidata(gcbf);
t = (0.8/handles.temps):(0.8/handles.temps):0.8;
xx=(0.8/handles.temps):(0.2/handles.temps):0.8;
if handles.N == 6
for i=1:handles.N
yy=spline(t,handles.(sprintf('intensitePixel%d',i)),xx);
subplot(3,2,i), plot(xx,yy), grid
end
else
for i=1:handles.N
yy=spline(t,handles.(sprintf('intensitePixel%d',i)),xx);
subplot(4,2,i), plot(xx,yy), grid
end
end
guidata(gcbf,handles);
%------------------------------------------------------------------------ |
merci d'avance.