EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • All Courses
    • All Specializations
  • Blog
  • Enterprise
  • Free Courses
  • All Courses
  • All Specializations
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials Matlab Tutorial Matlab Lists
 

Matlab Lists

Updated March 13, 2023

Matlab Lists

 

 

Introduction to Matlab Lists

MATLAB Lists can be ordered, unordered, multi-level, and can be created and formatted using the DOM API in a program that generates a report. A list can be created from an array string in MATLAB, which specifies the items in the list or creates a list with items inserted one by one. It is easy to create a list using an array, creating the list by inserting items one by one is handy when there are multiple elements in the item, like in the case of a table or paragraph.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Syntax:

  1. In MATLAB, we represent lists as mlreportgen.dom.OrderedList or mlreportgen.dom.UnorderedList objects
  2. mlreportgen.dom.ListItem objects are used to represent items of the lists

Description:

  1. mlreportgen.dom.OrderedList is used to create an ordered list
  2. mlreportgen.dom.UnorderedList is used to create an Unordered or bulleted list

Let us now understand the code to create a list in the MATLAB report.

Examples of Matlab Lists

Lets us discuss the examples of Matlab List.

Example #1

In the first example, we will create an unordered list in a MATLAB report. The list will be created from an array string. Below are the steps that we will follow for this example:

  1. Import the library mlreportgen.dom.*
  2. Initialize the document where we want to create the list
  3. Use the append method to append the document with the list items

Code:

import mlreportgen.dom.*

[Importing the required library]

Doc = Document("Employees", "html");

[Initializing the variable ‘Doc’ and storing the report to be appended in it]

App = append(Doc, ["Tom", "Jack", "Berlin", “Ryan”, “Harris”]);

[Appending the report ‘Employees’ using an array string]

close(Doc);

[Closing the report once it is appended]

rptview(Doc);

[Opening the report “Employees” to check if the list is created]

This is how our input and output will look like in the MATLAB command window:

Input:

import mlreportgen.dom.*
Doc = Document("Employees", "html");
App = append(Doc, ["Tom", "Jack", "Berlin", "Ryan", "Harris"]);
close(Doc);
rptview(Doc);

Output:

matlab list 1

As we can see in the OUTPUT, the report “Employees” is now appended with an unordered list as expected.

Example #2

Let us take another example where we create an unordered list in a MATLAB report. The list will be created from an array string. Below are the steps that we will follow for this example:

  1. Import the library mlreportgen.dom.*
  2. Initialize the document where we want to create the list
  3. Use the append method to append the document with the list items

Code:

import mlreportgen.dom.*

[Importing the required library]

Doc = Document("Organization", "html");

[Initializing the variable ‘Doc’ and storing the report to be appended in it]

App = append(Doc, ["TCS", "Reliance Industries", “HCL", “Capgemini”]);

[Appending the report ‘Organization’ using an array string]

close(Doc);

[Closing the report once it is appended]

rptview(Doc);

[Opening the report ‘Organization’ to check if the list is created]

This is how our input and output will look like in the MATLAB command window:

Input:

import mlreportgen.dom.*
Doc = Document("Organization", "html");
App = append(Doc, ["TCS", "Reliance Industries", "HCL", "Capgemini"]);
close(Doc);
rptview(Doc);

Output:

matlab list 2

As we can see in the OUTPUT, the report ‘Organization’ is now appended with an unordered list as expected.

In the above 2 examples, we created unordered lists using an array string. Next, we will learn to create an ordered list using an array string.

Example #3

In this example, we will create an ordered list in a MATLAB report. The list will be created from an array string. Below are the steps that we will follow for this example:

  1. Import the library mlreportgen.dom.*
  2. Initialize the document where we want to create the list
  3. Pass the input array string to the Ordered list constructor
  4. Use the append method to append the document with the list items

Code:

import mlreportgen.dom.*

[Importing the required library]

Doc = Document("Months", "html");

[Initializing the variable ‘Doc’ and storing the report to be appended in it]

NewList= OrderedList(["January", "February", "March", "April", "May"]);

[Creating a new variable and storing an ordered list in it]

append(Doc, NewList);

[Appending the report ‘Months’ using ‘NewList’ created in above step]

close(Doc);

[Closing the report once it is appended]

rptview(Doc);

[Opening the report ‘Months’ to check if the list is created]

This is how our input and output will look like in the MATLAB command window:

Input:

import mlreportgen.dom.*
Doc = Document("Months", "html");
NewList = OrderedList(["January", "February", "March", "April", "May"]);
append(Doc, NewList);
close(Doc);
rptview(Doc);

Output:

As we can see in the OUTPUT, the report ‘Months’ is now appended with an ordered list as expected.

matlab list 3

Example #4

In this example, we will create another ordered list in a MATLAB report. The list will be created from an array string. Below are the steps that we will follow for this example:

  1. Import the library mlreportgen.dom.*
  2. Initialize the document where we want to create the list
  3. Pass the input array string to the Ordered list constructor
  4. Use the append method to append the document with the list items

Code:

import mlreportgen.dom.*

[Importing the required library]

Doc = Document("Countries", "html");

[Initializing the variable ‘Doc’ and storing the report to be appended in it]

NewList= OrderedList(["India", "Australia", "Japan", "USA", "UK"]);

[Creating a new variable and storing an ordered list in it]

append(Doc, NewList);

[Appending the report ‘Countries’ using ‘NewList’ created in above step]

close(Doc);

[Closing the report once it is appended]

rptview(Doc);

[Opening the report ‘Countries’ to check if the list is created]

This is how our input and output will look like in the MATLAB command window:

Input:

import mlreportgen.dom.*
Doc = Document("Countries", "html");
NewList = OrderedList(["India", "Australia", "Japan", "USA", "UK"]);
append(Doc, NewList);
close(Doc);
rptview(Doc);

Output:

 example 4

As we can see in the OUTPUT, the report ‘Countries’ is now appended with an ordered list as expected.

Conclusion

mlreportgen.dom.OrderedList is used to create an ordered list in MATLAB. mlreportgen.dom.UnorderedList is used to create an Unordered or bulleted list in MATLAB. The items can be added to the list created using an array string.

Recommended Articles

This is a guide to Matlab Lists. Here we discuss the introduction to the Matlab Lists, syntax, examples with code implementation respectively. You may also have a look at the following articles to learn more –

  1. Matlab Syms
  2. Matlab Variables
  3. Bandpass Filter Matlab
  4. Matlab fwrite
Primary Sidebar
Footer
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW