function updateLivePlot(app)
   if isempty(app.DataFIFOBufferch1) || isempty(app.SelectedChannels)
   disableDefaultInteractivity(app.LiveAxes);
   app.LiveAxes.ColorOrderIndex = 1;
   xlabel(app.LiveAxes,"Time (s)")
   ylabel(app.LiveAxes, app.Units)
   if isempty(app.LivePlotLine)
       app.LivePlotLine = gobjects(size(app.UITable.Data(:,1))); 
       for ii = 1:numel(app.SelectedChannels)
           app.LivePlotLine(ii) = plot(app.LiveAxes, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1(:, ii));
       legend(app.LiveAxes,app.legnam(app.SelectedChannels))
       for i = 1:numel(app.SelectedChannels)
           if i <= numel(app.LivePlotLine) && ishandle(app.LivePlotLine(i))
                set(app.LivePlotLine(i), 'XData', app.TimestampsFIFOBuffer, 'YData', app.DataFIFOBufferch1(:,i));
               app.LivePlotLine(i) = plot(app.LiveAxes, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1(:, i));
       legend(app.LiveAxes,app.legnam(app.SelectedChannels))
   if numel(app.TimestampsFIFOBuffer) > 1
       xlim(app.LiveAxes, [app.TimestampsFIFOBuffer(1), app.TimestampsFIFOBuffer(end)]);
function updateLivePlot2(app)
   if isempty(app.DataFIFOBufferch1) || isempty(app.SelectedChannels)
   disableDefaultInteractivity(app.LiveAxes_2);
   disableDefaultInteractivity(app.LiveAxes_3);
   app.LiveAxes_2.ColorOrderIndex = 1;
   app.LiveAxes_3.ColorOrderIndex = 1;
   xlabel(app.LiveAxes_2,"Time (s)")
   ylabel(app.LiveAxes_2, app.Units)
   xlabel(app.LiveAxes_3,"Time (s)")
   ylabel(app.LiveAxes_3, app.Units)
   if isempty(app.LivePlotLine)
       app.LivePlotLine = gobjects(size(app.UITable.Data(:,1))); 
       for ii = 1:numel(app.SelectedChannels)
           if app.graphnums(ii) == 1
                app.LivePlotLine(ii) = plot(app.LiveAxes_2, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1(:, ii));
           elseif app.graphnums(ii) == 2
                app.LivePlotLine(ii) = plot(app.LiveAxes_3, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1(:, ii));
        for iii = app.SelectedChannels
            if app.graphnums(iii) == 1
             legend(app.LiveAxes_2,app.legnam(app.SelectedChannels(iii)))
            elseif app.graphnums(iii) == 2
             legend(app.LiveAxes_3,app.legnam(app.SelectedChannels(iii)))
       for i = 1:numel(app.SelectedChannels)
                if i <= numel(app.LivePlotLine) && ishandle(app.LivePlotLine(i))
                    set(app.LivePlotLine(i), 'XData', app.TimestampsFIFOBuffer, 'YData', app.DataFIFOBufferch1(:,i));
                    hold(app.LiveAxes_2, "on")
                    app.LivePlotLine(i) = plot(app.LiveAxes_2, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1(:,i));
                    hold(app.LiveAxes_2, "on") 
           elseif app.graphnums(i) == 2
               if i <= numel(app.LivePlotLine) && ishandle(app.LivePlotLine(i))
                 set(app.LivePlotLine(i), 'XData', app.TimestampsFIFOBuffer, 'YData', app.DataFIFOBufferch1(:,i));
                 hold(app.LiveAxes_3, "on")
                app.LivePlotLine(i) = plot(app.LiveAxes_3, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1(:, i));
                hold(app.LiveAxes_3, "on") 
    for iii = 1:numel(app.SelectedChannels)
        if app.graphnums(iii) == 1
            legend(app.LiveAxes_2,app.legnam(app.SelectedChannels(iii)))
        elseif app.graphnums(iii) == 2
            legend(app.LiveAxes_3,app.legnam(app.SelectedChannels(iii)))
    if numel(app.TimestampsFIFOBuffer) > 1
       xlim(app.LiveAxes_3, [app.TimestampsFIFOBuffer(1), app.TimestampsFIFOBuffer(end)]);
   if numel(app.TimestampsFIFOBuffer) > 1
       xlim(app.LiveAxes_2, [app.TimestampsFIFOBuffer(1), app.TimestampsFIFOBuffer(end)]);
     app.legnam = table2array(app.UITable.Data(:,1));
     app.SelectedChannels = find(table2array(app.UITable.Data(:,2)));
     app.SelectedCal = find(table2array(app.UITable.Data(:,3)));
     app.cals = table2array(app.UITable.Data(:,3));
     updateChannelMeasurementComponents(app)
     app.legnam = table2array(app.UITable.Data(:,1));
     app.SelectedChannels = find(table2array(app.UITable.Data(:,2)));
     app.SelectedCal = find(table2array(app.UITable.Data(:,3)));
     app.cals = table2array(app.UITable.Data(:,3));
     app.graphnums = (table2array(app.UITable.Data(:,4)));
         assignin("base","graphnums",app.graphnums)
     updateChannelMeasurementComponents(app)
  uialert(app.LiveDataAcquisitionUIFigure, exception.message, 'Selected channels too fast, Please press restore default buttons to avoid any other error and select channels at a slower speed. Thanks');   
  setAppViewState(app, 'configuration'); 
  app.legnam = table2array(app.UITable.Data(:,1));
  app.SelectedChannels = find(table2array(app.UITable.Data(:,2)));
  app.SelectedCal = find(table2array(app.UITable.Data(:,3)));
  app.cals = table2array(app.UITable.Data(:,3));
  app.graphnums = (table2array(app.UITable.Data(:,4)));