Matlab create html documentation

You can include HTML content, including JavaScript ® , CSS, and third-party visualizations or widgets, in your app by using an HTML UI component. If you create an app with an HTML UI component that is not working as expected, or if you want to know what your data looks like when converting between MATLAB ® and JavaScript, you can use your system browser to debug the code in the HTML source file. Using the Developer Tools (DevTools) of your browser, you can set breakpoints to test portions of your setup function. When you debug your HTML file through the system browser, you must simulate the connection between MATLAB and JavaScript that the setup function provides.

Create Sample HTML Source File

Create a sample HTML source file. Save this code to a file named sampleHTMLFile.html .

The sample file creates three elements:

The setup function in the sample file defines four callback functions:

       




View HTML File in Browser

To debug the code in your HTML source file, first open the file in your browser. From the Current Folder browser in MATLAB, right-click the sampleHTMLFile.html file and select Open Outside MATLAB.

Once the file is open in your browser, you can use the Developer Tools (DevTools) of your browser to set breakpoints in the file and access the console.

Simulate Sending Data from MATLAB to JavaScript

To debug how the code in your HTML file responds to component data changes from MATLAB, simulate the way that MATLAB sends component data to JavaScript.

  1. In MATLAB, run this code to convert a MATLAB cell array of character vectors to a JSON string. Copy the returned string value to your clipboard.
value = 'one';'two';'three'>; jsontxt = jsonencode(value)