Replacing multiple checkboxes with a dropdown

12 visualizaciones (últimos 30 días)
Karol Lach
Karol Lach el 9 de Sept. de 2022
Comentada: Karol Lach el 14 de Sept. de 2022
I work on Matlab R2021B
The thing is, whenever I try to generate more than 2 charts, they partially overlap, like this:
To fight this, I wanted to replace the checkboxes with a dropdown, so there will be only one chart displayed at any given time, but I'm struggling to code it.
Original code looks like this:
classdef IoTDataExplorerForThingSpeakUsingMATLAB < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
IoTDataExplorerForThingSpeakUIFigure matlab.ui.Figure
GridLayout matlab.ui.container.GridLayout
LeftPanel matlab.ui.container.Panel
WybierzdaneDropDown matlab.ui.control.DropDown
WybierzdaneDropDownLabel matlab.ui.control.Label
F8CheckBox matlab.ui.control.CheckBox
F7CheckBox matlab.ui.control.CheckBox
F6CheckBox matlab.ui.control.CheckBox
F5CheckBox matlab.ui.control.CheckBox
F4CheckBox matlab.ui.control.CheckBox
F3CheckBox matlab.ui.control.CheckBox
F2CheckBox matlab.ui.control.CheckBox
F1CheckBox matlab.ui.control.CheckBox
OutputtoWorkspaceButton matlab.ui.control.Button
MinDropDown matlab.ui.control.DropDown
MinDropDownLabel matlab.ui.control.Label
AMPMSwitch matlab.ui.control.Switch
AMPMSwitchLabel matlab.ui.control.Label
RetimeDropDownLabel matlab.ui.control.Label
RetimeDropDown matlab.ui.control.DropDown
plotLengthofComparison matlab.ui.control.NumericEditField
XEditFieldLabel matlab.ui.control.Label
plotDuration matlab.ui.control.NumericEditField
XEditField_2Label matlab.ui.control.Label
StartHourDropDown matlab.ui.control.DropDown
StartHourDropDownLabel matlab.ui.control.Label
ReadAPIKeyEditField matlab.ui.control.EditField
ReadAPIKeyEditFieldLabel matlab.ui.control.Label
ChannelIDEditField matlab.ui.control.NumericEditField
ChannelIDEditFieldLabel matlab.ui.control.Label
CompareLengthDropDown matlab.ui.control.DropDown
CompareLengthDropDownLabel matlab.ui.control.Label
DurationDropDown matlab.ui.control.DropDown
DurationDropDownLabel matlab.ui.control.Label
StartDateDatePicker matlab.ui.control.DatePicker
StartDateDatePickerLabel matlab.ui.control.Label
QuitButton matlab.ui.control.Button
UpdateButton matlab.ui.control.Button
RightPanel matlab.ui.container.Panel
StatusLabel matlab.ui.control.Label
end
% Properties that correspond to apps with auto-reflow
properties (Access = private)
onePanelWidth = 576;
end
% Copyright 2020 - 2020 The MathWorks, Inc.
properties (Access = public)
legendLabel1
legendLabel2
myChans
end
methods (Access = public)
function displayFields=enumerateSelectedFields(app)
displayFields = [app.F1CheckBox.Value, app.F2CheckBox.Value,app.F3CheckBox.Value,app.F4CheckBox.Value,app.F5CheckBox.Value,app.F6CheckBox.Value,app.F7CheckBox.Value,app.F8CheckBox.Value]
end
end
methods (Access = private)
function [query,queryRecent,queryOld] = buildQueryFromInputs(app)
% buildQueryFromInputs build the querry inputs into a struct.
% q = buildQueryFromInputs(app) is a list of inputs needed to
% get the appropriate data from ThingSpeak.
% The data includes the start and stop date, channel ID and
% API keys.
%
query = struct();
queryRecent = struct();
queryOld = struct();
app.StatusLabel.Text = 'Status';
query.APIKey = app.ReadAPIKeyEditField.Value;
query.channelID = app.ChannelIDEditField.Value;
query.startHour = hours(str2double(app.StartHourDropDown.Value));
query.startMinute = minutes(str2double(app.MinDropDown.Value));
query.dmult = app.plotDuration.Value;
query.lmult = app.plotLengthofComparison.Value;
% build the start date with date, minutes, hours and am/PM
queryRecent.startDate = app.StartDateDatePicker.Value + ...
query.startHour + query.startMinute;
if app.AMPMSwitch.Value == "PM"
queryRecent.startDate = queryRecent.startDate + hours(12);
end
queryRecent.endDate = queryRecent.startDate + getCompareDuration(app);
query.fieldsList = {};
queryDisplayFields = enumerateSelectedFields(app);
% build the fields list for ThingSpeak Read
for i= 1:8
if queryDisplayFields(i) > 0
query.fieldsList = [query.fieldsList, i];
end
end
query.fieldsList = cell2mat(query.fieldsList);
queryOld.startDate = queryRecent.startDate - getCompareWidth(app);
queryOld.endDate = queryOld.startDate + getCompareDuration(app);
end
function myData = getDataFromQuery(app, query,queryStartEnd)
% getDataFromQueryRecent() get the recent data.
% data = getDataFromQueryRecent(app, queryRecent) is a the
% most recent data. Requires buildQueryFromInputs to get
% startDate, endDate, fieldsList, channelID, and APIKey.
%
try
myData = thingSpeakRead(query.channelID, ...
'ReadKey', query.APIKey, ...
'DateRange',[queryStartEnd.startDate queryStartEnd.endDate], ...
'Fields', query.fieldsList, ...
'OutputFormat','Timetable');
catch readingError
myData = timetable();
uialert(app.IoTDataExplorerForThingSpeakUIFigure,readingError.identifier,"Data error for that time interval");
return
end
if isempty(myData)
uialert(app.IoTDataExplorerForThingSpeakUIFigure,"No Data for that time interval","Pick some different data");
myData = timetable();
return
end
if height(myData) >= 8000
app.StatusLabel.Text = "Read limit reached. Duration may be shorter than expected";
end
% Use retime if the user has selected that option
if app.RetimeDropDown.Value ~= "Raw"
myData = retime(myData,app.RetimeDropDown.Value,'linear');
end
end
function visualizeData(app,recentData, oldData, queryInfo)
% visualizeData() display the data.
% visualizeData(app,recentData, oldData) uses a the recentData and oldData to
% plot the data in a tiled layot depending on the number of
% fields selected.
dataDisplayFields = enumerateSelectedFields(app);
if sum(dataDisplayFields) > width(oldData)
uialert(app.IoTDataExplorerForThingSpeakUIFigure,"Not enough Fields selected","Pick a different channel or different fields.");
end
% Check to make sure the earlier functions produced data.
if width(recentData) == 0
return
end
if width(oldData) == 0
return
end
t = tiledlayout(app.RightPanel,sum(dataDisplayFields),1,'tilespacing','none');
% Change data to elapsed time
elapsedRecent = recentData.Timestamps - recentData.Timestamps(1) + ...
queryInfo.startHour + queryInfo.startMinute;
elapsedOld = oldData.Timestamps-oldData.Timestamps(1) + ...
queryInfo.startHour + queryInfo.startMinute;
% Determine which set is shortest.
minLength = min(height(oldData),height(recentData));
myTile = 0;
for index = 1:8
if dataDisplayFields(index)>0
myTile = myTile + 1;
myAxes = nexttile(t);
plotVar = recentData.(myTile);
plot(myAxes,elapsedRecent(1:minLength),plotVar(1:minLength),'-o','MarkerSize',2); %#<ADMTHDINV>
if app.CompareLengthDropDown.Value ~= minutes(0) % minutes(0) is the setting for don't show the old data
hold(myAxes,"on");
plotVar2=oldData.(myTile);
plot(myAxes,elapsedOld(1:minLength),plotVar2(1:minLength),'-*','MarkerSize',2);
end
title(myAxes,recentData.Properties.VariableNames(myTile));
if myTile > 1
set (myAxes,'xtick',[]);
legend(myAxes,["Recent" ,"Old"]);
else
legend(myAxes,{app.legendLabel1, app.legendLabel2});
end
end
end
end
function compareDuration = getCompareDuration(app)
% Determine the length in time of the data analysis for each
% window from the GUI inputs.
dmult = app.plotDuration.Value;
compareDuration = app.DurationDropDown.Value * dmult;
end
function legendLabel = getLegendLabel(app,startDate)
% Format the legendLabel based on the start data and duration
% selected.
dmult = app.plotDuration.Value;
switch app.DurationDropDown.Value
case minutes(1)
legendLabel = string(dmult) + ' Minutes on ' + string(startDate);
case hours(1)
legendLabel = string(dmult) + ' Hours on ' + string(startDate);
case hours(24)
legendLabel = string(dmult) + ' Days on ' + string(startDate);
case days(7)
legendLabel = string(dmult) + ' Weeks on ' + string(startDate);
case days(365)
legendLabel = string(dmult) + ' Years on ' + string(startDate);
end
if app.RetimeDropDown.Value ~= "Raw"
legendLabel = legendLabel + " " + string(app.RetimeDropDown.Value);
end
end
function compareWidth = getCompareWidth(app)
% Determine the difference in time from the recent data to the
% older data from the GUI inputs.
lmult = app.plotLengthofComparison.Value;
compareWidth = app.CompareLengthDropDown.Value * lmult;
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
% This fucntion sets the startup items for the duration and
% compare dropdowns If you put them in the items for the
% object, they will not evaluate, i.e. you will get a string
% minutes(1) etc.
app.DurationDropDown.ItemsData = [minutes(1), hours(1), days(1), days(7)];
app.CompareLengthDropDown.ItemsData = [minutes(0),minutes(1),hours(1), days(1), days(7),days(365)];
end
% Changes arrangement of the app based on UIFigure width
function updateAppLayout(app, event)
currentFigureWidth = app.IoTDataExplorerForThingSpeakUIFigure.Position(3);
if(currentFigureWidth <= app.onePanelWidth)
% Change to a 2x1 grid
app.GridLayout.RowHeight = {511, 511};
app.GridLayout.ColumnWidth = {'1x'};
app.RightPanel.Layout.Row = 2;
app.RightPanel.Layout.Column = 1;
else
% Change to a 1x2 grid
app.GridLayout.RowHeight = {'1x'};
app.GridLayout.ColumnWidth = {241, '1x'};
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
end
end
% Button pushed function: UpdateButton
function UpdateButtonPushed(app, event)
% Determine the user selections
[query,queryRecent,queryOld] = buildQueryFromInputs(app);
% Retrieve data from ThingSpeak based on the selections
recentData = getDataFromQuery(app,query,queryRecent);
oldData = getDataFromQuery(app,query,queryOld);
app.legendLabel1 = getLegendLabel(app,queryRecent.startDate);
app.legendLabel2 = string(queryOld.startDate);
% Plot the data
visualizeData(app,recentData, oldData, query)
end
% Callback function
function SelectChannelDropDownValueChanged(app, event)
end
% Button pushed function: QuitButton
function QuitButtonPushed(app, event)
app.delete
end
% Button pushed function: OutputtoWorkspaceButton
function OutputtoWorkspaceButtonPushed(app, event)
% Open a UI window to save the data to workspace variables.
[query,queryRecent,queryOld] = buildQueryFromInputs(app);
recentData = getDataFromQuery(app,query,queryRecent);
oldData = getDataFromQuery(app,query,queryOld);
labels = {'Save recent data to timetable named:' 'Save old data to timetable named:'};
vars = {'oldData','recentData'};
values = {recentData,oldData};
export2wsdlg(labels,vars,values);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create IoTDataExplorerForThingSpeakUIFigure and hide until all components are created
app.IoTDataExplorerForThingSpeakUIFigure = uifigure('Visible', 'off');
app.IoTDataExplorerForThingSpeakUIFigure.AutoResizeChildren = 'off';
app.IoTDataExplorerForThingSpeakUIFigure.Position = [100 100 710 511];
app.IoTDataExplorerForThingSpeakUIFigure.Name = 'ThingSpeak Data Explorer';
app.IoTDataExplorerForThingSpeakUIFigure.SizeChangedFcn = createCallbackFcn(app, @updateAppLayout, true);
% Create GridLayout
app.GridLayout = uigridlayout(app.IoTDataExplorerForThingSpeakUIFigure);
app.GridLayout.ColumnWidth = {241, '1x'};
app.GridLayout.RowHeight = {'1x'};
app.GridLayout.ColumnSpacing = 0;
app.GridLayout.RowSpacing = 0;
app.GridLayout.Padding = [0 0 0 0];
app.GridLayout.Scrollable = 'on';
% Create LeftPanel
app.LeftPanel = uipanel(app.GridLayout);
app.LeftPanel.Layout.Row = 1;
app.LeftPanel.Layout.Column = 1;
% Create UpdateButton
app.UpdateButton = uibutton(app.LeftPanel, 'push');
app.UpdateButton.ButtonPushedFcn = createCallbackFcn(app, @UpdateButtonPushed, true);
app.UpdateButton.BackgroundColor = [0 1 0];
app.UpdateButton.Position = [124 146 73 22];
app.UpdateButton.Text = 'Update';
% Create QuitButton
app.QuitButton = uibutton(app.LeftPanel, 'push');
app.QuitButton.ButtonPushedFcn = createCallbackFcn(app, @QuitButtonPushed, true);
app.QuitButton.BackgroundColor = [1 0 0];
app.QuitButton.Position = [124 82 72 22];
app.QuitButton.Text = 'Quit';
% Create StartDateDatePickerLabel
app.StartDateDatePickerLabel = uilabel(app.LeftPanel);
app.StartDateDatePickerLabel.HorizontalAlignment = 'right';
app.StartDateDatePickerLabel.Position = [8 376 67 22];
app.StartDateDatePickerLabel.Text = 'Start Date';
% Create StartDateDatePicker
app.StartDateDatePicker = uidatepicker(app.LeftPanel);
app.StartDateDatePicker.Position = [117 376 109 22];
app.StartDateDatePicker.Value = datetime([2020 3 18]);
% Create DurationDropDownLabel
app.DurationDropDownLabel = uilabel(app.LeftPanel);
app.DurationDropDownLabel.HorizontalAlignment = 'right';
app.DurationDropDownLabel.Position = [7 275 57 22];
app.DurationDropDownLabel.Text = 'Duration';
% Create DurationDropDown
app.DurationDropDown = uidropdown(app.LeftPanel);
app.DurationDropDown.Items = {'Minute', 'Hour', 'Day', 'Week'};
app.DurationDropDown.Position = [102 275 65 22];
app.DurationDropDown.Value = 'Day';
% Create CompareLengthDropDownLabel
app.CompareLengthDropDownLabel = uilabel(app.LeftPanel);
app.CompareLengthDropDownLabel.HorizontalAlignment = 'right';
app.CompareLengthDropDownLabel.Position = [10 244 90 22];
app.CompareLengthDropDownLabel.Text = 'Compare Length';
% Create CompareLengthDropDown
app.CompareLengthDropDown = uidropdown(app.LeftPanel);
app.CompareLengthDropDown.Items = {'None', 'Minute', 'Hour', 'Day', 'Week', 'Year'};
app.CompareLengthDropDown.Position = [113 244 67 22];
app.CompareLengthDropDown.Value = 'Week';
% Create ChannelIDEditFieldLabel
app.ChannelIDEditFieldLabel = uilabel(app.LeftPanel);
app.ChannelIDEditFieldLabel.HorizontalAlignment = 'right';
app.ChannelIDEditFieldLabel.Position = [12 464 66 22];
app.ChannelIDEditFieldLabel.Text = 'Channel ID';
% Create ChannelIDEditField
app.ChannelIDEditField = uieditfield(app.LeftPanel, 'numeric');
app.ChannelIDEditField.ValueDisplayFormat = '%.0f';
app.ChannelIDEditField.Position = [93 464 55 22];
app.ChannelIDEditField.Value = 38629;
% Create ReadAPIKeyEditFieldLabel
app.ReadAPIKeyEditFieldLabel = uilabel(app.LeftPanel);
app.ReadAPIKeyEditFieldLabel.HorizontalAlignment = 'right';
app.ReadAPIKeyEditFieldLabel.Position = [13 434 74 22];
app.ReadAPIKeyEditFieldLabel.Text = 'ReadAPIKey';
% Create ReadAPIKeyEditField
app.ReadAPIKeyEditField = uieditfield(app.LeftPanel, 'text');
app.ReadAPIKeyEditField.Position = [102 434 100 22];
% Create StartHourDropDownLabel
app.StartHourDropDownLabel = uilabel(app.LeftPanel);
app.StartHourDropDownLabel.HorizontalAlignment = 'right';
app.StartHourDropDownLabel.Position = [10 348 63 22];
app.StartHourDropDownLabel.Text = 'Start Hour';
% Create StartHourDropDown
app.StartHourDropDown = uidropdown(app.LeftPanel);
app.StartHourDropDown.Items = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'};
app.StartHourDropDown.ItemsData = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'};
app.StartHourDropDown.Position = [22 325 44 22];
app.StartHourDropDown.Value = '0';
% Create XEditField_2Label
app.XEditField_2Label = uilabel(app.LeftPanel);
app.XEditField_2Label.HorizontalAlignment = 'right';
app.XEditField_2Label.Position = [172 275 25 22];
app.XEditField_2Label.Text = 'X';
% Create plotDuration
app.plotDuration = uieditfield(app.LeftPanel, 'numeric');
app.plotDuration.Limits = [1 365];
app.plotDuration.Position = [205 275 30 22];
app.plotDuration.Value = 1;
% Create XEditFieldLabel
app.XEditFieldLabel = uilabel(app.LeftPanel);
app.XEditFieldLabel.HorizontalAlignment = 'right';
app.XEditFieldLabel.Position = [172 244 25 22];
app.XEditFieldLabel.Text = 'X';
% Create plotLengthofComparison
app.plotLengthofComparison = uieditfield(app.LeftPanel, 'numeric');
app.plotLengthofComparison.Limits = [1 365];
app.plotLengthofComparison.Position = [205 244 30 22];
app.plotLengthofComparison.Value = 1;
% Create RetimeDropDown
app.RetimeDropDown = uidropdown(app.LeftPanel);
app.RetimeDropDown.Items = {'Raw', 'minutely', 'hourly', 'daily', 'weekly', 'monthly'};
app.RetimeDropDown.Position = [107 210 89 22];
app.RetimeDropDown.Value = 'Raw';
% Create RetimeDropDownLabel
app.RetimeDropDownLabel = uilabel(app.LeftPanel);
app.RetimeDropDownLabel.HorizontalAlignment = 'right';
app.RetimeDropDownLabel.Position = [47 210 45 22];
app.RetimeDropDownLabel.Text = 'Retime';
% Create AMPMSwitchLabel
app.AMPMSwitchLabel = uilabel(app.LeftPanel);
app.AMPMSwitchLabel.HorizontalAlignment = 'center';
app.AMPMSwitchLabel.Position = [169 346 45 22];
app.AMPMSwitchLabel.Text = 'AM/PM';
% Create AMPMSwitch
app.AMPMSwitch = uiswitch(app.LeftPanel, 'slider');
app.AMPMSwitch.Items = {'AM', 'PM'};
app.AMPMSwitch.Position = [166 325 45 20];
app.AMPMSwitch.Value = 'AM';
% Create MinDropDownLabel
app.MinDropDownLabel = uilabel(app.LeftPanel);
app.MinDropDownLabel.HorizontalAlignment = 'right';
app.MinDropDownLabel.Position = [80 348 36 22];
app.MinDropDownLabel.Text = 'Min';
% Create MinDropDown
app.MinDropDown = uidropdown(app.LeftPanel);
app.MinDropDown.Items = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60'};
app.MinDropDown.ItemsData = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60'};
app.MinDropDown.Position = [92 325 44 22];
app.MinDropDown.Value = '0';
% Create OutputtoWorkspaceButton
app.OutputtoWorkspaceButton = uibutton(app.LeftPanel, 'push');
app.OutputtoWorkspaceButton.ButtonPushedFcn = createCallbackFcn(app, @OutputtoWorkspaceButtonPushed, true);
app.OutputtoWorkspaceButton.BackgroundColor = [0.8 0.8 0.8];
app.OutputtoWorkspaceButton.Position = [97 115 128 22];
app.OutputtoWorkspaceButton.Text = 'Output to Workspace';
% Create F1CheckBox
app.F1CheckBox = uicheckbox(app.LeftPanel);
app.F1CheckBox.Text = 'F1';
app.F1CheckBox.Position = [14 178 36 22];
app.F1CheckBox.Value = true;
% Create F2CheckBox
app.F2CheckBox = uicheckbox(app.LeftPanel);
app.F2CheckBox.Text = 'F2';
app.F2CheckBox.Position = [13 157 36 22];
% Create F3CheckBox
app.F3CheckBox = uicheckbox(app.LeftPanel);
app.F3CheckBox.Text = 'F3';
app.F3CheckBox.Position = [14 136 36 22];
% Create F4CheckBox
app.F4CheckBox = uicheckbox(app.LeftPanel);
app.F4CheckBox.Text = 'F4';
app.F4CheckBox.Position = [14 115 36 22];
% Create F5CheckBox
app.F5CheckBox = uicheckbox(app.LeftPanel);
app.F5CheckBox.Text = 'F5';
app.F5CheckBox.Position = [14 94 36 22];
% Create F6CheckBox
app.F6CheckBox = uicheckbox(app.LeftPanel);
app.F6CheckBox.Text = 'F6';
app.F6CheckBox.Position = [14 73 36 22];
% Create F7CheckBox
app.F7CheckBox = uicheckbox(app.LeftPanel);
app.F7CheckBox.Text = 'F7';
app.F7CheckBox.Position = [14 52 36 22];
% Create F8CheckBox
app.F8CheckBox = uicheckbox(app.LeftPanel);
app.F8CheckBox.Text = 'F8';
app.F8CheckBox.Position = [13 31 36 22];
% Create WybierzdaneDropDownLabel
app.WybierzdaneDropDownLabel = uilabel(app.LeftPanel);
app.WybierzdaneDropDownLabel.HorizontalAlignment = 'right';
app.WybierzdaneDropDownLabel.Position = [47 31 79 22];
app.WybierzdaneDropDownLabel.Text = 'Wybierz dane';
% Create WybierzdaneDropDown
app.WybierzdaneDropDown = uidropdown(app.LeftPanel);
app.WybierzdaneDropDown.Items = {'Dane 1', 'Dane 2', 'Dane 3', 'Dane 4', 'Dane 5', 'Dane 6', 'Dane 7', 'Dane 8'};
app.WybierzdaneDropDown.ItemsData = [1 2 3 4 5 6 7 8];
app.WybierzdaneDropDown.Position = [141 31 100 22];
app.WybierzdaneDropDown.Value = 1;
% Create RightPanel
app.RightPanel = uipanel(app.GridLayout);
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
% Create StatusLabel
app.StatusLabel = uilabel(app.RightPanel);
app.StatusLabel.Position = [2 1 449 22];
app.StatusLabel.Text = 'Status';
% Show the figure after all components are created
app.IoTDataExplorerForThingSpeakUIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = IoTDataExplorerForThingSpeakUsingMATLAB
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.IoTDataExplorerForThingSpeakUIFigure)
% 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.IoTDataExplorerForThingSpeakUIFigure)
end
end
end
I tried to rewrite function displayFields=enumerateSelectedFields(app) (line 61) to use a table of my own, but it didn't work.
How should I do this?

Respuestas (2)

Image Analyst
Image Analyst el 9 de Sept. de 2022
Maybe you should use stackedplot.
If you have any more trouble, attach the .mlapp file with the paperclip icon - it will be more convenient for us to download it. Either the one with checkboxes, or your attempt at converting it to a drop down list.

Karol Lach
Karol Lach el 9 de Sept. de 2022
I've added the original ver. with checkboxes. In the meantime I'll try to implement stackedplot as suggested.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by