for i=1:size(ax,1)
    cid=logical(ones(size(ax,1),1));
    cid(i)=0;
    [mbr2bbcr,ysipreds,bvects]=jpredorth(ax(cid,1:256),ax(cid,258),1,ax(:,1:256),ax(:,258),1);
    loop(i,:)=ysipreds(i,:);
end

x=[cal;val];
ax=avp(x,8);
clear loop

for i=1:size(ax,1)/7
    % cid=logical(ones(size(ax,1),1));
    % cid(i)=0;
    cid=logical(ones(7,1)*ones(1,size(ax,1)/7));
    cid(:,i)=0;
    cid=cid(:);
    
    % [hr,rcal]=rba(ax(cid,1:256),ax(cid,end),500,25);
    [mbr2bbcr,ysipreds,bvects]=jpredosic(avp(ax(cid,1:256)',4)',ax(cid,258),1,avp(ax(:,1:256)',4)',ax(:,258),7);
    loop(i,:)=ysipreds(i,:);
end

figure
plot(ax(:,end-1),ax(:,end),'.',avp(ax(:,end-1),7),avp(loop(:,64),1),'o' ...
    );grid
xlabel('Time')
ylabel('Blood Glucose Concentration (mg/dL)')
legend('FS Spline','ProtoData','FS')
title('Proto Measurements: Mike June 17-18, 2024, (Pam''s Glucometer as Reference Values)')
%ylim([50 140]);
