function []=updateresultplots(varnum,plotnum)
%This function acts as an updater for the colorbar limits of
%vpraqparsedplottriplet.


global b_full limn repeat replotval plotnames plotnow;
limnbcol=cell2mat(plotnames(:,2))';
if nargin>1
    minval=str2num(get(findobj('Tag',['Edittext minlimn',int2str(varnum) 'TS']),'String'));
    maxval=str2num(get(findobj('Tag',['Edittext maxlimn',int2str(varnum) 'TS']),'String'));
else
    minval=str2num(get(findobj('Tag',['Edittext minlimn',int2str(varnum)]),'String'));
    maxval=str2num(get(findobj('Tag',['Edittext maxlimn',int2str(varnum)]),'String'));
end
if minval>max(b_full(:,limnbcol(varnum))) || maxval<min(b_full(:,limnbcol(varnum)))
    h=gcbf;
    h1 = uicontrol('Parent',h, ...
        'Units','normalized', ...
        'ForegroundColor','r', ...
        'BackgroundColor','k', ...
        'fontunits','normalized','fontsize',.6, ...
        'FontWeight','normal', ...
        'ListboxTop',0, ...
        'Position',[0.48 0.07 0.21 0.0401], ...
        'String','Limits out of range', ...
        'Style','text', ...
        'Tag','StaticText Folder', ...
        'TooltipString',['The limits selected will exclude all data.' char(10) 'Choose new limis, then press button again.']);
else
    limn(varnum,:)=[minval,maxval];
    repeat=1;
    plotnow=1;
    if replotval==-1
        closeplots;
    end
end