I am trying to find the mean for each point in a series of 16 profiles. The code is as following
a= table2array (DataTot);
b= standardizeMissing(a,nan);
b = reshape(a,[181,4,16]);
for i=1:16
xx= b(:,1,i);
yy=b(:,4,i);
yyc = yy;
[maxHValue, indexAtMaxH] = findpeaks(yyc);
xshift=xx(yyc==max(maxHValue));
xxs=xx - xshift;
xxs = rmmissing(xxs);
yyc = rmmissing(yy);
XYint = interp1(xxs,yyc,-100:1:200);
L(i)= XYint
end
When I try to store in L it doesn't allow me to do so(ERROR="unable to perform assignment because the indices on the left side are not compatible with the size of the right side"). Is there a way to find the mean while inside the loop for the interpolated values or should I store it to use the data after the loop?
Thanks for the help.
2 Comments
David Hill (view profile)
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/490887-how-to-store-an-interpolated-data-to-get-the-mean-for-each-new-point-in-x#comment_766886
Pedro Oliveira (view profile)
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/490887-how-to-store-an-interpolated-data-to-get-the-mean-for-each-new-point-in-x#comment_766936
Sign in to comment.