Code:
classdef Final < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
PlotPeaksLocationsDropDown matlab.ui.control.DropDown
PlotPeaksLocationsDropDownLabel matlab.ui.control.Label
NumofHistogramBinsEditField matlab.ui.control.NumericEditField
NumofHistogramBinsEditFieldLabel matlab.ui.control.Label
ArrythmiatypeEditField matlab.ui.control.EditField
ArrythmiatypeEditFieldLabel matlab.ui.control.Label
MinpeakprominenceEditField matlab.ui.control.NumericEditField
MinpeakprominenceEditFieldLabel matlab.ui.control.Label
SaveButton matlab.ui.control.Button
NotesTextArea matlab.ui.control.TextArea
NotesTextAreaLabel matlab.ui.control.Label
MinpeakheightEditField matlab.ui.control.NumericEditField
MinpeakheightEditFieldLabel matlab.ui.control.Label
AscendDescendDropDown matlab.ui.control.DropDown
MaxMinpeaksLabel matlab.ui.control.Label
ChangeofpeaksEditField matlab.ui.control.NumericEditField
ChangeofpeaksEditFieldLabel matlab.ui.control.Label
AnalyzeButton matlab.ui.control.Button
PlotButton matlab.ui.control.Button
DrugDropDown matlab.ui.control.DropDown
ChoosedrugDropDownLabel matlab.ui.control.Label
WeekDropDown matlab.ui.control.DropDown
ChooseweekDropDownLabel matlab.ui.control.Label
HistoAxes matlab.ui.control.UIAxes
ECGaxes matlab.ui.control.UIAxes
end
properties (Access = private)
ECG_data = load('/Users/livnikolich/Downloads/Final_Project_Data.mat');
selected_week;
week_list;
temp_time;
temp_ECG;
selected_drug;
pks;
locs;
outliers;
count;
count2;
peakInterval;
AverageDistance_Peaks;
meanValue;
temp_pks;
temp_locs;
NumPeaksValue;
lengthPeaks;
newDistance;
ascendValue;
MinPeakHeightValue;
heightPeaks;
filename;
file;
Notes; % Description
writenCell; % Description
NoteschangingValue; % Description
MinpeakProminencevalue;
ArrythmiaValue;
ArrythmiaChangingValue;
medianValue;
NumHistoBins; % Description
PlotPeaksValue;
PlotPeaks;
LowerMean;
HigherMean; % Description
HighPkDiff; % High peak difference
LowPkDiff;
index;
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.WeekDropDown.Items = fieldnames(app.ECG_data.DATA);
app.WeekDropDown.Value = app.WeekDropDown.Items{1};
app.DrugDropDown.Items = fieldnames(app.ECG_data.DATA.Week_4);
app.DrugDropDown.Value = app.DrugDropDown.Items{1};
end
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
app.temp_time = app.ECG_data.DATA.(app.WeekDropDown.Value).(app.DrugDropDown.Value).Time;
app.temp_ECG = app.ECG_data.DATA.(app.WeekDropDown.Value).(app.DrugDropDown.Value).ECG;
plot(app.ECGaxes, app.temp_time, app.temp_ECG);
hold(app.ECGaxes,"on");
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence',0.5, 'MinPeakDistance', 50);
plot(app.ECGaxes, app.temp_time(app.locs), app.pks, 'm*');
hold(app.ECGaxes,"off");
histogram(app.HistoAxes, app.pks, 10);
hold(app.HistoAxes,"on");
hold(app.HistoAxes,"off");
end
% Drop down opening function: WeekDropDown
function WeekDropDownOpening(app, event)
app.WeekDropDown.Items = fieldnames(app.ECG_data.DATA);
end
% Drop down opening function: DrugDropDown
function DrugDropDownOpening(app, event)
app.DrugDropDown.Items = fieldnames(app.ECG_data.DATA.Week_4);
end
% Value changed function: WeekDropDown
function WeekDropDownValueChanged(app, event)
app.selected_week = app.WeekDropDown.Value;
end
% Value changed function: DrugDropDown
function DrugDropDownValueChanged(app, event)
app.selected_drug = app.DrugDropDown.Value;
end
% Button down function: UIFigure
function UIFigureButtonDown(app, event)
end
% Button pushed function: AnalyzeButton
function AnalyzeButtonPushed(app, event)
% AKA our Algorithm:
% checks if clustered (AKA arythmia 1)
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence', 3.5 , 'MinPeakDistance', 50);
app.peakInterval = diff(app.locs);
app.AverageDistance_Peaks = mean(diff(app.locs));
if (app.AverageDistance_Peaks <= 100)
app.ArrythmiatypeEditField.Value = " 1 ";
else % checks if the peaks are higher or lower (2/3)
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence', 0.5, 'MinPeakDistance', 50);
app.count = 0;
app.count2 = 0;
app.meanValue = mean(app.pks);
mask1 = app.pks < app.meanValue;
app.LowerMean = mean(app.pks(mask1));
mask2 = app.pks > app.meanValue;
app.HigherMean = mean(app.pks(mask2));
if isnan(app.meanValue) % Accounts for errors if only one peak is found
app.meanValue = 0; % avoids errors
end
if isnan(app.LowerMean)
app.LowerMean = 0;
end
if isnan(app.HigherMean)
app.HigherMean = 100; % rand large num
end
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence', 0.5, 'MinPeakDistance', 50);
app.outliers = isoutlier(app.pks,"median");
for i = 1:length(app.pks)
if (app.meanValue < app.pks(i)) % HIGHER: Arrythmia 2
if app.outliers(i) == true
if(app.pks(i) > app.HigherMean) % if even higher than this
app.HighPkDiff = app.pks(i) - app.HigherMean;
app.count = app.count + 2; % extra count for outliers
else
app.count = app.count + 1; % summation of number of peaks that would be negative
end
end
elseif(app.meanValue > app.pks(i))% LOWER: Arrythmia 3
if app.outliers(i) == true
if(app.pks(i) < app.LowerMean) % if even lower than this
app.LowPkDiff = app.HigherMean - app.pks(i);
app.count2 = app.count2 + 2; % extra count for outliers
else
app.count2 = app.count2 + 1; % summation of number of peaks that would be negative
end
end
end
end
% count = number of outliers above the mean
% count2 = number of outliers below the mean
switch app.count
case 1
app.count = app.count + 1;
case 2
app.count = app.count - 1;
end
switch app.count2
case 1
app.count2 = app.count2 + 1;
case 2
app.count2 = app.count2 - 1;
end
if(app.HighPkDiff > app.LowPkDiff)
app.ArrythmiatypeEditField.Value = " 2 ";
elseif(isempty(app.LowPkDiff) == true)
app.ArrythmiatypeEditField.Value = " 2 ";
else
app.ArrythmiatypeEditField.Value = " 3 ";
end
end
end
% Value changed function: ChangeofpeaksEditField
function ChangeofpeaksEditFieldValueChanged(app, event)
app.NumPeaksValue = app.ChangeofpeaksEditField.Value;
if (app.NumPeaksValue == 0)
app.NumPeaksValue = 2;
end
app.lengthPeaks = length(app.pks);
app.newDistance = app.lengthPeaks / app.NumPeaksValue;
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'NPeaks',app.NumPeaksValue, 'MinPeakProminence',0.5, 'MinPeakDistance', 50 * app.newDistance * 1.5);
plot(app.ECGaxes, app.temp_time, app.temp_ECG);
hold(app.ECGaxes,"on");
plot(app.ECGaxes, app.temp_time(app.locs), app.pks, 'm*');
hold(app.ECGaxes,"off");
end
% Drop down opening function: AscendDescendDropDown
function AscendDescendDropDownOpening(app, event)
app.AscendDescendDropDown.Items = ["Min", "Max"];
end
% Value changed function: AscendDescendDropDown
function AscendDescendDropDownValueChanged(app, event)
app.ascendValue = app.AscendDescendDropDown.Value;
if (app.NumPeaksValue == 0)
app.NumPeaksValue = 2;
end
switch app.ascendValue
case "Min"
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'SortStr', 'ascend', 'NPeaks', app.NumPeaksValue);
plot(app.ECGaxes, app.temp_time, app.temp_ECG);
hold(app.ECGaxes,"on");
plot(app.ECGaxes, app.temp_time(app.locs), app.pks, 'y*');
hold(app.ECGaxes, "off");
case "Max"
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'SortStr', 'descend', 'NPeaks', app.NumPeaksValue);
plot(app.ECGaxes, app.temp_time, app.temp_ECG);
hold(app.ECGaxes,"on");
plot(app.ECGaxes, app.temp_time(app.locs), app.pks, 'g*');
hold(app.ECGaxes, "off");
end
end
% Value changed function: MinpeakheightEditField
function MinpeakheightEditFieldValueChanged(app, event)
app.MinPeakHeightValue = app.MinpeakheightEditField.Value;
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakHeight',app.MinPeakHeightValue, 'MinPeakProminence',0.5, 'MinPeakDistance', 50);
plot(app.ECGaxes, app.temp_time, app.temp_ECG);
hold(app.ECGaxes,"on");
plot(app.ECGaxes, app.temp_time(app.locs), app.pks, 'r*');
hold(app.ECGaxes,"off");
end
% Button pushed function: SaveButton
function SaveButtonPushed(app, event)
app.filename = "";
if (app.selected_week == "Week_4")
if(app.selected_drug == "Drug_1")
app.filename = "Week_4_Drug_1.txt";
else
app.filename = "Week_4_Drug_2.txt";
end
elseif (app.selected_week == "Week_5")
if(app.selected_drug == "Drug_1")
app.filename = "Week_5_Drug_1.txt";
else
app.filename = "Week_5_Drug_2.txt";
end
elseif (app.selected_week == "Week_6")
if(app.selected_drug == "Drug_1")
app.filename = "Week_6_Drug_1.txt";
else
app.filename = "Week_6_Drug_2.txt";
end
elseif (app.selected_week == "Week_7")
if(app.selected_drug == "Drug_1")
app.filename = "Week_7_Drug_1.txt";
else
app.filename = "Week_7_Drug_2.txt";
end
end
writecell(app.Notes, app.filename);
end
% Value changed function: NotesTextArea
function NotesTextAreaValueChanged(app, event)
app.Notes = app.NotesTextArea.Value;
end
% Callback function: NotesTextArea
function NotesTextAreaValueChanging(app, event)
app.NoteschangingValue = event.Value;
end
% Value changed function: MinpeakprominenceEditField
function MinpeakprominenceEditFieldValueChanged(app, event)
app.MinpeakProminencevalue = app.MinpeakprominenceEditField.Value;
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence', app.MinpeakProminencevalue, 'MinPeakDistance', 50);
plot(app.ECGaxes, app.temp_time, app.temp_ECG);
hold(app.ECGaxes,"on");
plot(app.ECGaxes, app.temp_time(app.locs), app.pks, 'c*');
hold(app.ECGaxes,"off");
end
% Value changed function: ArrythmiatypeEditField
function ArrythmiatypeEditFieldValueChanged(app, event)
app.ArrythmiaValue = app.ArrythmiatypeEditField.Value;
end
% Value changing function: ArrythmiatypeEditField
function ArrythmiatypeEditFieldValueChanging(app, event)
app.ArrythmiaChangingValue = event.Value;
end
% Value changed function: NumofHistogramBinsEditField
function NumofHistogramBinsEditFieldValueChanged(app, event)
app.NumHistoBins = app.NumofHistogramBinsEditField.Value;
histogram(app.HistoAxes, app.locs, app.NumHistoBins, 'FaceColor','r');
hold(app.HistoAxes,"on");
hold(app.HistoAxes,"off");
end
% Value changed function: PlotPeaksLocationsDropDown
function PlotPeaksLocationsDropDownValueChanged(app, event)
app.PlotPeaksValue = app.PlotPeaksLocationsDropDown.Value;
switch app.PlotPeaksValue
case "Peaks"
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence', .5 , 'MinPeakDistance', 50);
histogram(app.HistoAxes, app.pks, 10);
hold(app.HistoAxes,"on");
hold(app.HistoAxes,"off");
case "Locations"
[app.pks, app.locs] = findpeaks(app.temp_ECG, 'MinPeakProminence', .5 , 'MinPeakDistance', 50);
histogram(app.HistoAxes, app.locs, 10);
hold(app.HistoAxes,"on");
hold(app.HistoAxes,"off");
end
end
% Drop down opening function: PlotPeaksLocationsDropDown
function PlotPeaksLocationsDropDownOpening(app, event)
app.PlotPeaks.Items = ["Peaks", "Locations"];
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
app.UIFigure.ButtonDownFcn = createCallbackFcn(app, @UIFigureButtonDown, true);
% Create ECGaxes
app.ECGaxes = uiaxes(app.UIFigure);
title(app.ECGaxes, 'ECG Waveforms')
xlabel(app.ECGaxes, 'Time (seconds)')
ylabel(app.ECGaxes, 'mV')
zlabel(app.ECGaxes, 'Z')
app.ECGaxes.AmbientLightColor = [0.9412 0.9412 0.9412];
app.ECGaxes.FontName = 'Comic Sans MS';
app.ECGaxes.XColor = [0.4941 0.1843 0.5569];
app.ECGaxes.YColor = [0.6353 0.0784 0.1843];
app.ECGaxes.ZColor = [0 0.4471 0.7412];
app.ECGaxes.Color = [0.902 0.902 0.902];
app.ECGaxes.GridColor = [0.0745 0.6235 1];
app.ECGaxes.MinorGridColor = [0.9294 0.6941 0.1255];
app.ECGaxes.Position = [13 233 342 227];
% Create HistoAxes
app.HistoAxes = uiaxes(app.UIFigure);
title(app.HistoAxes, 'Histogram of ECG Peaks')
xlabel(app.HistoAxes, 'mV Value of Peaks')
ylabel(app.HistoAxes, 'Counts')
zlabel(app.HistoAxes, 'Z')
app.HistoAxes.AmbientLightColor = [0.9412 0.9412 0.9412];
app.HistoAxes.FontName = 'Comic Sans MS';
app.HistoAxes.XColor = [0.7176 0.2745 1];
app.HistoAxes.YColor = [0 0.4471 0.7412];
app.HistoAxes.ZColor = [0.6353 0.0784 0.1843];
app.HistoAxes.Color = [0.902 0.902 0.902];
app.HistoAxes.GridColor = [0.3922 0.8314 0.0745];
app.HistoAxes.MinorGridColor = [1 0.4118 0.1608];
app.HistoAxes.Position = [13 11 342 210];
% Create ChooseweekDropDownLabel
app.ChooseweekDropDownLabel = uilabel(app.UIFigure);
app.ChooseweekDropDownLabel.BackgroundColor = [0.902 0.902 0.902];
app.ChooseweekDropDownLabel.HorizontalAlignment = 'right';
app.ChooseweekDropDownLabel.FontName = 'Comic Sans MS';
app.ChooseweekDropDownLabel.FontColor = [0.851 0.3255 0.098];
app.ChooseweekDropDownLabel.Position = [434 438 76 22];
app.ChooseweekDropDownLabel.Text = 'Choose week';
% Create WeekDropDown
app.WeekDropDown = uidropdown(app.UIFigure);
app.WeekDropDown.Items = {'Week 4', 'Week 5', 'Week 6', 'Week 7'};
app.WeekDropDown.DropDownOpeningFcn = createCallbackFcn(app, @WeekDropDownOpening, true);
app.WeekDropDown.ValueChangedFcn = createCallbackFcn(app, @WeekDropDownValueChanged, true);
app.WeekDropDown.FontName = 'Comic Sans MS';
app.WeekDropDown.FontColor = [0.851 0.3255 0.098];
app.WeekDropDown.Position = [525 438 100 22];
app.WeekDropDown.Value = 'Week 4';
% Create ChoosedrugDropDownLabel
app.ChoosedrugDropDownLabel = uilabel(app.UIFigure);
app.ChoosedrugDropDownLabel.BackgroundColor = [0.902 0.902 0.902];
app.ChoosedrugDropDownLabel.HorizontalAlignment = 'right';
app.ChoosedrugDropDownLabel.FontName = 'Comic Sans MS';
app.ChoosedrugDropDownLabel.FontColor = [0.4667 0.6745 0.1882];
app.ChoosedrugDropDownLabel.Position = [436 402 74 22];
app.ChoosedrugDropDownLabel.Text = 'Choose drug';
% Create DrugDropDown
app.DrugDropDown = uidropdown(app.UIFigure);
app.DrugDropDown.Items = {'Drug 1', 'Drug 2'};
app.DrugDropDown.DropDownOpeningFcn = createCallbackFcn(app, @DrugDropDownOpening, true);
app.DrugDropDown.ValueChangedFcn = createCallbackFcn(app, @DrugDropDownValueChanged, true);
app.DrugDropDown.FontName = 'Comic Sans MS';
app.DrugDropDown.FontColor = [0.4667 0.6745 0.1882];
app.DrugDropDown.Position = [525 402 100 22];
app.DrugDropDown.Value = 'Drug 1';
% Create PlotButton
app.PlotButton = uibutton(app.UIFigure, 'push');
app.PlotButton.ButtonPushedFcn = createCallbackFcn(app, @PlotButtonPushed, true);
app.PlotButton.BackgroundColor = [0.502 0.502 0.502];
app.PlotButton.FontName = 'Comic Sans MS';
app.PlotButton.FontSize = 16;
app.PlotButton.FontWeight = 'bold';
app.PlotButton.FontColor = [1 1 0.0667];
app.PlotButton.Position = [385 161 100 32];
app.PlotButton.Text = 'Plot';
% Create AnalyzeButton
app.AnalyzeButton = uibutton(app.UIFigure, 'push');
app.AnalyzeButton.ButtonPushedFcn = createCallbackFcn(app, @AnalyzeButtonPushed, true);
app.AnalyzeButton.BackgroundColor = [0.502 0.502 0.502];
app.AnalyzeButton.FontName = 'Comic Sans MS';
app.AnalyzeButton.FontSize = 16;
app.AnalyzeButton.FontWeight = 'bold';
app.AnalyzeButton.FontColor = [1 0.4118 0.1608];
app.AnalyzeButton.Position = [516 158 102 35];
app.AnalyzeButton.Text = 'Analyze';
% Create ChangeofpeaksEditFieldLabel
app.ChangeofpeaksEditFieldLabel = uilabel(app.UIFigure);
app.ChangeofpeaksEditFieldLabel.BackgroundColor = [0.902 0.902 0.902];
app.ChangeofpeaksEditFieldLabel.HorizontalAlignment = 'right';
app.ChangeofpeaksEditFieldLabel.FontName = 'Comic Sans MS';
app.ChangeofpeaksEditFieldLabel.FontColor = [1 0 1];
app.ChangeofpeaksEditFieldLabel.Position = [404 304 110 22];
app.ChangeofpeaksEditFieldLabel.Text = 'Change # of peaks';
% Create ChangeofpeaksEditField
app.ChangeofpeaksEditField = uieditfield(app.UIFigure, 'numeric');
app.ChangeofpeaksEditField.ValueChangedFcn = createCallbackFcn(app, @ChangeofpeaksEditFieldValueChanged, true);
app.ChangeofpeaksEditField.FontColor = [1 0 1];
app.ChangeofpeaksEditField.Position = [529 304 100 22];
% Create MaxMinpeaksLabel
app.MaxMinpeaksLabel = uilabel(app.UIFigure);
app.MaxMinpeaksLabel.BackgroundColor = [0.902 0.902 0.902];
app.MaxMinpeaksLabel.HorizontalAlignment = 'right';
app.MaxMinpeaksLabel.FontName = 'Comic Sans MS';
app.MaxMinpeaksLabel.FontColor = [0 0.4471 0.7412];
app.MaxMinpeaksLabel.Position = [405 369 98 22];
app.MaxMinpeaksLabel.Text = 'Max / Min peaks';
% Create AscendDescendDropDown
app.AscendDescendDropDown = uidropdown(app.UIFigure);
app.AscendDescendDropDown.Items = {'Min', 'Max'};
app.AscendDescendDropDown.DropDownOpeningFcn = createCallbackFcn(app, @AscendDescendDropDownOpening, true);
app.AscendDescendDropDown.ValueChangedFcn = createCallbackFcn(app, @AscendDescendDropDownValueChanged, true);
app.AscendDescendDropDown.FontName = 'Comic Sans MS';
app.AscendDescendDropDown.FontColor = [0 0.4471 0.7412];
app.AscendDescendDropDown.Position = [525 369 100 22];
app.AscendDescendDropDown.Value = 'Min';
% Create MinpeakheightEditFieldLabel
app.MinpeakheightEditFieldLabel = uilabel(app.UIFigure);
app.MinpeakheightEditFieldLabel.BackgroundColor = [0.902 0.902 0.902];
app.MinpeakheightEditFieldLabel.HorizontalAlignment = 'right';
app.MinpeakheightEditFieldLabel.FontName = 'Comic Sans MS';
app.MinpeakheightEditFieldLabel.FontColor = [0.6353 0.0784 0.1843];
app.MinpeakheightEditFieldLabel.Position = [420 272 94 22];
app.MinpeakheightEditFieldLabel.Text = 'Min peak height';
% Create MinpeakheightEditField
app.MinpeakheightEditField = uieditfield(app.UIFigure, 'numeric');
app.MinpeakheightEditField.ValueChangedFcn = createCallbackFcn(app, @MinpeakheightEditFieldValueChanged, true);
app.MinpeakheightEditField.FontColor = [0.6353 0.0784 0.1843];
app.MinpeakheightEditField.Position = [529 272 100 22];
% Create NotesTextAreaLabel
app.NotesTextAreaLabel = uilabel(app.UIFigure);
app.NotesTextAreaLabel.BackgroundColor = [0.902 0.902 0.902];
app.NotesTextAreaLabel.HorizontalAlignment = 'right';
app.NotesTextAreaLabel.FontName = 'Comic Sans MS';
app.NotesTextAreaLabel.FontColor = [0.851 0.3255 0.098];
app.NotesTextAreaLabel.Position = [397 82 43 22];
app.NotesTextAreaLabel.Text = 'Notes:';
% Create NotesTextArea
app.NotesTextArea = uitextarea(app.UIFigure);
app.NotesTextArea.ValueChangedFcn = createCallbackFcn(app, @NotesTextAreaValueChanged, true);
app.NotesTextArea.ValueChangingFcn = createCallbackFcn(app, @NotesTextAreaValueChanging, true);
app.NotesTextArea.Position = [455 11 170 95];
% Create SaveButton
app.SaveButton = uibutton(app.UIFigure, 'push');
app.SaveButton.ButtonPushedFcn = createCallbackFcn(app, @SaveButtonPushed, true);
app.SaveButton.FontName = 'Comic Sans MS';
app.SaveButton.FontColor = [0.9294 0.6941 0.1255];
app.SaveButton.Position = [399 32 50 25];
app.SaveButton.Text = 'Save';
% Create MinpeakprominenceEditFieldLabel
app.MinpeakprominenceEditFieldLabel = uilabel(app.UIFigure);
app.MinpeakprominenceEditFieldLabel.BackgroundColor = [0.902 0.902 0.902];
app.MinpeakprominenceEditFieldLabel.HorizontalAlignment = 'right';
app.MinpeakprominenceEditFieldLabel.FontName = 'Comic Sans MS';
app.MinpeakprominenceEditFieldLabel.FontColor = [0.302 0.7451 0.9333];
app.MinpeakprominenceEditFieldLabel.Position = [392 240 122 22];
app.MinpeakprominenceEditFieldLabel.Text = 'Min peak prominence';
% Create MinpeakprominenceEditField
app.MinpeakprominenceEditField = uieditfield(app.UIFigure, 'numeric');
app.MinpeakprominenceEditField.ValueChangedFcn = createCallbackFcn(app, @MinpeakprominenceEditFieldValueChanged, true);
app.MinpeakprominenceEditField.FontColor = [0.302 0.7451 0.9333];
app.MinpeakprominenceEditField.Position = [529 240 100 22];
% Create ArrythmiatypeEditFieldLabel
app.ArrythmiatypeEditFieldLabel = uilabel(app.UIFigure);
app.ArrythmiatypeEditFieldLabel.BackgroundColor = [0.902 0.902 0.902];
app.ArrythmiatypeEditFieldLabel.HorizontalAlignment = 'right';
app.ArrythmiatypeEditFieldLabel.FontName = 'Comic Sans MS';
app.ArrythmiatypeEditFieldLabel.FontColor = [0.4667 0.6745 0.1882];
app.ArrythmiatypeEditFieldLabel.Position = [404 123 96 22];
app.ArrythmiatypeEditFieldLabel.Text = 'Arrythmia type:';
% Create ArrythmiatypeEditField
app.ArrythmiatypeEditField = uieditfield(app.UIFigure, 'text');
app.ArrythmiatypeEditField.ValueChangedFcn = createCallbackFcn(app, @ArrythmiatypeEditFieldValueChanged, true);
app.ArrythmiatypeEditField.ValueChangingFcn = createCallbackFcn(app, @ArrythmiatypeEditFieldValueChanging, true);
app.ArrythmiatypeEditField.Position = [515 123 100 22];
% Create NumofHistogramBinsEditFieldLabel
app.NumofHistogramBinsEditFieldLabel = uilabel(app.UIFigure);
app.NumofHistogramBinsEditFieldLabel.BackgroundColor = [0.902 0.902 0.902];
app.NumofHistogramBinsEditFieldLabel.HorizontalAlignment = 'right';
app.NumofHistogramBinsEditFieldLabel.FontName = 'Comic Sans MS';
app.NumofHistogramBinsEditFieldLabel.FontColor = [0.4941 0.1843 0.5569];
app.NumofHistogramBinsEditFieldLabel.Position = [380 212 135 22];
app.NumofHistogramBinsEditFieldLabel.Text = 'Num of Histogram Bins';
% Create NumofHistogramBinsEditField
app.NumofHistogramBinsEditField = uieditfield(app.UIFigure, 'numeric');
app.NumofHistogramBinsEditField.ValueChangedFcn = createCallbackFcn(app, @NumofHistogramBinsEditFieldValueChanged, true);
app.NumofHistogramBinsEditField.FontName = 'Comic Sans MS';
app.NumofHistogramBinsEditField.FontColor = [0.4941 0.1843 0.5569];
app.NumofHistogramBinsEditField.Position = [530 212 100 22];
% Create PlotPeaksLocationsDropDownLabel
app.PlotPeaksLocationsDropDownLabel = uilabel(app.UIFigure);
app.PlotPeaksLocationsDropDownLabel.BackgroundColor = [0.902 0.902 0.902];
app.PlotPeaksLocationsDropDownLabel.HorizontalAlignment = 'right';
app.PlotPeaksLocationsDropDownLabel.FontName = 'Comic Sans MS';
app.PlotPeaksLocationsDropDownLabel.FontColor = [0.4941 0.1843 0.5569];
app.PlotPeaksLocationsDropDownLabel.Position = [382 337 128 22];
app.PlotPeaksLocationsDropDownLabel.Text = 'Plot Peaks / Locations';
% Create PlotPeaksLocationsDropDown
app.PlotPeaksLocationsDropDown = uidropdown(app.UIFigure);
app.PlotPeaksLocationsDropDown.Items = {'Peaks', 'Locations'};
app.PlotPeaksLocationsDropDown.DropDownOpeningFcn = createCallbackFcn(app, @PlotPeaksLocationsDropDownOpening, true);
app.PlotPeaksLocationsDropDown.ValueChangedFcn = createCallbackFcn(app, @PlotPeaksLocationsDropDownValueChanged, true);
app.PlotPeaksLocationsDropDown.FontName = 'Comic Sans MS';
app.PlotPeaksLocationsDropDown.FontColor = [0.4941 0.1843 0.5569];
app.PlotPeaksLocationsDropDown.Position = [525 337 100 22];
app.PlotPeaksLocationsDropDown.Value = 'Peaks';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = Final
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end