Skip to content

Commit

Permalink
Merge pull request #6 from mathworks/StartupPerformance
Browse files Browse the repository at this point in the history
Startup performance
  • Loading branch information
ebenetce authored Sep 6, 2024
2 parents c9daf67 + 91be710 commit 6298ba5
Show file tree
Hide file tree
Showing 27 changed files with 144 additions and 71 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The repository contains a MATLAB app that contains a visual interface to some li

IAMDataExplorer

![](HowTo.gif)
![](tbx/doc/HowTo.gif)

The app will load the NGFS scenario by default, but this can be changed at will.

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"></Label>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="loanData.mat" type="File"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"></Label>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="exportToWorspace.m" type="File"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="1" type="DIR_SIGNIFIER"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="workflows" type="File"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="test"></Label>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="tWorkbook.m" type="File"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="1" type="DIR_SIGNIFIER"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="ci.yml" type="File"></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info></Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location=".github" type="File"></Info>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" ?>
<Info location="HowTo.gif" type="File"></Info>
105 changes: 47 additions & 58 deletions tbx/IAMDataExplorer/+iam/+controls/IAMworkbook.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
properties (Access = public)

MainGridLayout matlab.ui.container.GridLayout

TabGroup matlab.ui.container.TabGroup
PlottingTab matlab.ui.container.Tab

GridLayout matlab.ui.container.GridLayout
RegionsListBox matlab.ui.control.ListBox
RegionsListBoxLabel matlab.ui.control.Label
Expand Down Expand Up @@ -63,10 +61,8 @@

g1 = uigridlayout([1 2], varargin{:});
g1.ColumnWidth = {'1x', '2x'};

g1.Padding = [0 0 0 0];
obj.MainGridLayout = g1;


obj.MainGridLayout = g1;
obj.createComponents

end
Expand Down Expand Up @@ -231,8 +227,9 @@ function LoadWorkspaceButtonPushed(obj)
namevar = fields(var);
try
obj.addData(var.(namevar{1}));
catch
uialert(obj.IAMExplorerUIFigure, 'Invalid data')
catch e
f = ancestor(obj.MainGridLayout, 'figure', 'toplevel');
uialert(f , e.message, 'Invalid Data', Icon = 'error');
end
end
end
Expand All @@ -259,12 +256,7 @@ function exportData(obj, filter)
data = obj.Data;
end

if isdeployed()
uisave('data')
else
var = inputdlg('Please select a name','Export to Workspace',1);
assignin('base', var{1}, data)
end
iam.utils.exportToWorspace(data)
end

% Value changed function: ModelsListBox
Expand Down Expand Up @@ -292,16 +284,8 @@ function VariablesListBoxValueChanged(obj)
end

function sendDataToPlot(obj)

switch obj.TabGroup.SelectedTab.Title
case "Plotting"
obj.WbAxes.changeData(obj.FilteredData)

case "Analysis"
tb = obj.FilteredData.summary();
obj.IAMvars.Data = tb{:,:};
obj.IAMvars.ColumnName = tb.Properties.VariableNames;
end

obj.WbAxes.changeData(obj.FilteredData)

end

Expand All @@ -311,19 +295,8 @@ function sendDataToPlot(obj)
methods (Access = private)

% Create UIFigure and components
function createComponents(obj)

% Create TabGroup
obj.TabGroup = uitabgroup(obj.MainGridLayout);
obj.TabGroup.Layout.Column = 2;
obj.TabGroup.SelectionChangedFcn = @(s,e) obj.sendDataToPlot();
function createComponents(obj)

% Create PlottingTab
obj.PlottingTab = uitab(obj.TabGroup);
obj.PlottingTab.Title = 'Plotting';

obj.TabGroup.SelectedTab = obj.PlottingTab;

% Create GridLayout
obj.GridLayout = uigridlayout(obj.MainGridLayout);
obj.GridLayout.ColumnWidth = {'1x', '1x'};
Expand All @@ -332,103 +305,119 @@ function createComponents(obj)
obj.GridLayout.RowSpacing = 0;
obj.GridLayout.Padding = [0 0 0 0];
obj.GridLayout.Layout.Row = 1;
obj.GridLayout.Layout.Column = 1;
obj.GridLayout.Layout.Column = 1;

% Set Search Database Tab axis
obj.WbAxes = iam.views.IAMChart('Parent',obj.PlottingTab);

% Set Figure
obj.WbAxes = iam.views.IAMChart('Parent',obj.MainGridLayout);
obj.WbAxes.GridLayout.BackgroundColor = [0.23,0.29,0.22];
obj.WbAxes.UIAxes.XColor = 'w';
obj.WbAxes.UIAxes.YColor = 'w';
obj.WbAxes.UIAxes.GridColor = 'k';
obj.WbAxes.CheckBox.FontColor = 'w';
obj.WbAxes.Label.FontColor = 'w';

% Create GridLayout2
g2 = uigridlayout(obj.MainGridLayout, [5 4]);
g2.Layout.Row = 1;
g2.Layout.Column = 1;
g2.RowHeight = {30, 30, '10x', 30, '10x'};
g2.RowHeight = {20, '10x', 20, '10x', 30};
g2.Padding = [5 5 5 5];
g2.BackgroundColor = [0.61,0.81,0.57];

% Create ModelsListBox
obj.ModelsListBox = uilistbox(g2);
obj.ModelsListBox.Items = {};
obj.ModelsListBox.Multiselect = 'on';
obj.ModelsListBox.ValueChangedFcn = @(s,e) obj.ModelsListBoxValueChanged();
obj.ModelsListBox.Layout.Row = 3;
obj.ModelsListBox.Layout.Row = 2;
obj.ModelsListBox.Layout.Column = [1 2];
obj.ModelsListBox.Value = {};

% Create ModelsListBoxLabel
obj.ModelsListBoxLabel = uilabel(g2);
obj.ModelsListBoxLabel.Layout.Row = 2;
obj.ModelsListBoxLabel.Layout.Row = 1;
obj.ModelsListBoxLabel.Layout.Column = [1 2];
obj.ModelsListBoxLabel.Text = 'Models';
obj.ModelsListBoxLabel.Text = 'MODELS';
obj.ModelsListBoxLabel.FontWeight = "bold";
obj.ModelsListBoxLabel.HorizontalAlignment = "center";

% Create ScenariosListBoxLabel
obj.ScenariosListBoxLabel = uilabel(g2);
obj.ScenariosListBoxLabel.Layout.Row = 2;
obj.ScenariosListBoxLabel.Layout.Row = 1;
obj.ScenariosListBoxLabel.Layout.Column = [3 4];
obj.ScenariosListBoxLabel.Text = 'Scenarios';
obj.ScenariosListBoxLabel.Text = 'SCENARIOS';
obj.ScenariosListBoxLabel.FontWeight = "bold";
obj.ScenariosListBoxLabel.HorizontalAlignment = "center";

% Create ScenariosListBox
obj.ScenariosListBox = uilistbox(g2);
obj.ScenariosListBox.Items = {};
obj.ScenariosListBox.Multiselect = 'on';
obj.ScenariosListBox.ValueChangedFcn = @(s,e) obj.ScenariosListBoxValueChanged();
obj.ScenariosListBox.Layout.Row = 3;
obj.ScenariosListBox.Layout.Row = 2;
obj.ScenariosListBox.Layout.Column = [3 4];
obj.ScenariosListBox.Value = {};

% Create VariablesListBoxLabel
obj.VariablesListBoxLabel = uilabel(g2);
obj.VariablesListBoxLabel.Layout.Row = 4;
obj.VariablesListBoxLabel.Layout.Row = 3;
obj.VariablesListBoxLabel.Layout.Column = [1 2];
obj.VariablesListBoxLabel.Text = 'Variables';
obj.VariablesListBoxLabel.Text = 'VARIABLES';
obj.VariablesListBoxLabel.FontWeight = "bold";
obj.VariablesListBoxLabel.HorizontalAlignment = "center";

% Create VariablesListBox
obj.VariablesListBox = uilistbox(g2);
obj.VariablesListBox.Items = {};
obj.VariablesListBox.Multiselect = 'on';
obj.VariablesListBox.ValueChangedFcn = @(s,e) obj.VariablesListBoxValueChanged();
obj.VariablesListBox.Layout.Row = 5;
obj.VariablesListBox.Layout.Row = 4;
obj.VariablesListBox.Layout.Column = [1 2];
obj.VariablesListBox.Value = {};

% Create RegionsListBoxLabel
obj.RegionsListBoxLabel = uilabel(g2);
obj.RegionsListBoxLabel.Layout.Row = 4;
obj.RegionsListBoxLabel.Layout.Row = 3;
obj.RegionsListBoxLabel.Layout.Column = [3 4];
obj.RegionsListBoxLabel.Text = 'Regions';
obj.RegionsListBoxLabel.Text = 'REGIONS';
obj.RegionsListBoxLabel.FontWeight = "bold";
obj.RegionsListBoxLabel.HorizontalAlignment = "center";

% Create RegionsListBox
obj.RegionsListBox = uilistbox(g2);
obj.RegionsListBox.Items = {};
obj.RegionsListBox.Multiselect = 'on';
obj.RegionsListBox.ValueChangedFcn = @(s,e) obj.RegionsListBoxValueChanged();
obj.RegionsListBox.Layout.Row = 5;
obj.RegionsListBox.Layout.Row = 4;
obj.RegionsListBox.Layout.Column = [3 4];
obj.RegionsListBox.Value = {};

% Create LoadWorkspaceButton
obj.LoadWorkspaceButton = uibutton(g2, 'push');
% obj.LoadWorkspaceButton.ButtonPushedFcn = @(s,e) obj.LoadWorkspaceButtonPushed();
obj.LoadWorkspaceButton.Layout.Row = 1;
obj.LoadWorkspaceButton.ButtonPushedFcn = @(s,e) obj.LoadWorkspaceButtonPushed();
obj.LoadWorkspaceButton.Layout.Row = 5;
obj.LoadWorkspaceButton.Layout.Column = 1;
obj.LoadWorkspaceButton.Text = 'Load';

% Create ExportSelectedButton
obj.ExportSelectedButton = uibutton(g2, 'push');
obj.ExportSelectedButton.ButtonPushedFcn = @(s,e) obj.ExportSelectedButtonPushed;
obj.ExportSelectedButton.Layout.Row = 1;
obj.ExportSelectedButton.Layout.Row = 5;
obj.ExportSelectedButton.Layout.Column = 2;
obj.ExportSelectedButton.Text = 'Export';

% Create ExportAllButton
obj.ExportAllButton = uibutton(g2, 'push');
obj.ExportAllButton.ButtonPushedFcn = @(s,e) obj.ExportAllButtonPushed;
obj.ExportAllButton.Layout.Row = 1;
obj.ExportAllButton.Layout.Row = 5;
obj.ExportAllButton.Layout.Column = 3;
obj.ExportAllButton.Text = 'Export All';

% Create ClearWorkspaceButton
obj.ClearWorkspaceButton = uibutton(g2, 'push');
obj.ClearWorkspaceButton.ButtonPushedFcn = @(s,e) obj.ClearWorkspaceButtonPushed;
obj.ClearWorkspaceButton.Layout.Row = 1;
obj.ClearWorkspaceButton.Layout.Row = 5;
obj.ClearWorkspaceButton.Layout.Column = 4;
obj.ClearWorkspaceButton.Text = 'Clear';

Expand Down
10 changes: 10 additions & 0 deletions tbx/IAMDataExplorer/+iam/+utils/exportToWorspace.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function exportToWorspace(data)

if isdeployed()
uisave('data')
else
var = inputdlg('Please select a name','Export to Workspace',1);
assignin('base', var{1}, data)
end

end
Binary file modified tbx/IAMDataExplorer/+iam/DataExplorer.mlapp
Binary file not shown.
File renamed without changes
14 changes: 4 additions & 10 deletions tests/tUserInterfaces.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
App
end
methods (TestMethodSetup)
function loadApp(tc)
function loadApp(tc)
tc.App = IAMDataExplorer;
end
end
Expand All @@ -15,10 +15,8 @@ function tGuestLogin(testCase)
testCase.press(testCase.App.GuestLoginButton)
testCase.verifyFalse(isvalid(testCase.App))
h = findall(0,'Type','figure', 'Name','IAM Explorer');
t = timerfindall;
wait(t)
t = h.RunningAppInstance;
testCase.verifyNotEmpty(t);

testCase.verifyTrue(isvalid(h));
delete(h);
end
Expand All @@ -27,12 +25,8 @@ function tBoC(testCase)
testCase.choose(testCase.App.BOCTab);
testCase.press(testCase.App.LoginButton_3)
h = findall(0,'Type','figure', 'Name','IAM Explorer');

t = timerfindall;
if ~isempty(t)
wait(t)
end

t = h.RunningAppInstance;
testCase.verifyNotEmpty(t);
testCase.verifyTrue(isvalid(h));
delete(h);

Expand Down
Loading

0 comments on commit 6298ba5

Please sign in to comment.