Dash for MATLAB® provides an interface to use the Dash library and create analytic web applications fully in MATLAB®. Create and share MATLAB® analysis with business stakeholders through Dash, the leading low-code platform for data science web apps!
This folder contains examples of usage:
- Determine which Button Changed with
callback_context
, (button) - Interactive statistical scatter plot with slider, (slider_scatter)
- Multi-input callback example, (multi_input)
This folder contains backend helper functions:
- startDash.m - starts the app from a set of components or a gridlayout.
- addLayout.m - builds the layout for the Dash app.
- argsIn.m - Wrapper for Dash callback input arguments.
- argsOut.m - Wrapper for Dash callback output arguments.
- createApp.m - Creates the Dash web server object.
- ui2dash.m - Converts MATLAB UI components to Dash components.
- plotlyfig2dash.m - Converts Plotly MATLAB figures to Dash Graph components.
- Html.m - dash_html_components constructor
- Dcc.m - dash_core_components constructor
Please make sure that you have a compatible Python version installed. If your Python version is different, consider downgrading it or using pyenv.
-
Install Dash plotting library:
pip install dash
-
Install dash-bootstrap-components:
pip install dash-bootstrap-components
-
Install Plotly Graphing Library for MATLAB: Download its sources and install in MATLAB® with:
cd ~/Downloads/plotly-graphing-library-for-matlab-master
plotlysetup_offline()
Don't use plotlysetup_online()
with Dash for MATLAB®.
- Add
lib
folder to your MATLAB® path:
addpath('~/dash_matlab/lib')
(You can also do this in the GUI, add with subfolderslib
:
Deploying MATLAB® Dash apps on AWS:
https://github.com/mathworks-ref-arch/matlab-on-aws-win
Please install Matlab and other requirements from this readme
on remote EC2
machine and change folder to aws_multi_input example,
run script with these commands:
screen -dmS matt /matlab/bin/matlab -r comm
/matlab/bin/matlab -batch 'multi_arg(8050)' &
/matlab/bin/matlab -batch 'multi_arg(8051)' &
- In the first command, MATLAB® starts with shared session for callback execution from multiple machines,
- In the 2nd and 3rd commans, the Dash app server start with
port
arguments (ports 8050 and 8051). - In total, we have 3 MATLAB® instances running for 2 Dash apps at ports 8050 and 8051.
Now Dash web applications can be accessed from any public machine IP and port 8050! Please refer to the [file source code] (https://github.com/plotly/dash_matlab/tree/main/Examples/aws_multi_input) for further implementation details.