test.coefs is giving you the coefficients of the cubic splines that make up the fit. If I interpret your intention correctly, you're wanting the actual fitted curve. To do that, use feval:
yFitted = feval(fit,xData);
Now you can use findpeaks on yFitted (assuming that yData was a vector originally, so this is a 1-D fit).
xData = sort(rand(295,1));
yData = sin(6*pi*xData) + 0.1*randn(295,1);
ft = fittype( 'smoothingspline' );
opts = fitoptions( 'Method', 'SmoothingSpline' );
opts.SmoothingParam = 0.9999;
[fitresult, gof] = fit( xData, yData, ft, opts );
yfitted = feval(fitresult,xData);
plot(xData,yData,xData,yfitted)
[ypk,idx] = findpeaks(yfitted);
xpk = xData(idx);
hold on
plot(xpk,ypk,'o')
Best Answer