{"id":3457,"date":"2021-01-24T16:14:30","date_gmt":"2021-01-24T09:14:30","guid":{"rendered":"https:\/\/gulfthai.com\/?page_id=3457"},"modified":"2021-10-23T20:16:24","modified_gmt":"2021-10-23T13:16:24","slug":"simulink-basic-program","status":"publish","type":"page","link":"https:\/\/gulfthai.com\/?page_id=3457","title":{"rendered":"Matlab &#038; Simulink Advanced Programming"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Fundamental Courses<\/strong><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>MATLAB Fundamental<\/strong> <br><strong><a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951018638490146\">Virtual 1950 USD \/500 USD (2021)<\/a><\/strong><\/h2>\n\n\n\n<p>VDO <a href=\"https:\/\/www.youtube.com\/watch?v=dWK32RlMbzE\">\u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 1<\/a> \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21)<br>VDO <a href=\"https:\/\/youtu.be\/uJFJOZtJHDQ\">\u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 2<\/a> \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21) <br>VDO <a href=\"https:\/\/youtu.be\/gez8Jq0vbVk\">\u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 3<\/a> \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21)  <br>VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 4 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21)  <br>VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 5 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21) <br>VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 6 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21)  <br>VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 7 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21)   <\/p>\n\n\n\n<p><strong>Course Description<\/strong><br>Modules<br>Course Quick Reference<br><strong>Getting Started<\/strong><br>Overview of the course. Entering MATLAB commands, importing and saving data, and using the MATLAB documentation.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Overview<br>Entering Commands<br>Getting Data into MATLAB<br>Obtaining Help<br>The MATLAB Editor<br>Summary of Getting Started<br>Plotting and Common Modifications70 min100%<br>Create plots of vector data. Modify, annotate, and export plots.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Visualizing Gasoline Prices<br>Plotting<br>Annotating Plots<br>Axis Control<br>Exporting Figures<br>Summary of Plotting<br>Working with Live Scripts45 min100%<br>Create, use, format, and share live scripts.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Using a Script to Automate Plotting Gasoline Prices<br>Create and Run a Script<br>Code Sections<br>Comments and Text<br>Sharing Live Scripts<br>Summary of Live Scripts<br>Creating and Manipulating Arrays140 min100%<br>Create, combine, and reshape arrays.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Arrays of Data<br>Manually Entering Arrays<br>Creating Evenly-Spaced Vectors<br>Concatenating Arrays<br>Array Creation Functions<br>Reshaping Arrays<br>Summary of Creating and Manipulating Arrays<\/p>\n\n\n\n<p>Accessing Data in Arrays60 min94%<br>Extract subsets of arrays, and modify elements in an array.<\/p>\n\n\n\n<p><strong>Lessons<\/strong><br>Course Example &#8211; Accessing Data in Arrays<br>Accessing Data in Vectors<br>Accessing Data in Matrices<br>Summary of Accessing Data in Arrays<br>Mathematical and Statistical Operations with Arrays120 min100%<br>Use arrays as mathematical objects or as collections of (vector) data. Understand the appropriate use of MATLAB to distinguish between these applications.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Electricity Consumption<br>Performing Operations on Arrays<br>Calculating Statistics of Vectors<br>Using Statistical Operations on Matrices<br>Matrix Multiplication<br>Summary of Operations with Arrays<br>Visualizing Data in 2D and 3D105 min100%<br>Identify and use plot types for 2D and 3D visualization. Modify plot properties.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Identifying Available Vector Plot Types<br>Annotating with Multiple Strings of Text<br>Customizing Plot Properties<br>Plotting Multiple Columns<br>Visualizing Matrices<br>Summary of Visualizing Data in 2D and 3D<br>Conditional Data Selection90 min100%<br>Extract and analyze subsets of data that satisfy given criteria.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Home Field Advantage<br>Logical Operations and Variables<br>Counting Elements<br>Logical Indexing<br>Summary of Conditional Data Selection<br>Review Project I5 min100%<br>Tie together several topics covered in the course<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Project &#8211; Halfway Review of Fundamentals<br>Tables of Data125 min100%<br>Import data as a MATLAB table. Work with data stored as a table.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Storing Premier League Data<br>Storing Data in a Table<br>Sorting Table Data<br>Extracting Portions of a Table<br>Extracting Data from a Table<br>Exporting Tables<br>Summary of Tables of Data<br>Organizing Data145 min100%<br>Store data in relevant data types. Operate on the data types.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Premier League Team Information<br>Combining Tables<br>Table Properties<br>Indexing into Cell Arrays<br>Working with Dates and Times<br>Operating on Dates and Times<br>Representing Discrete Categories<br>Summary of Organizing Data<\/p>\n\n\n\n<p>Preprocessing Data85 min5%<br>Perform typical data preprocessing tasks in MATLAB, including normalizing data and dealing with missing data.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Preprocessing Electricity Usage Data<br>Normalizing Data<br>Working with Missing Data<br>Interpolating Missing Data<br>Summary of Preprocessing Data<br>Common Data Analysis Techniques85 min<br>Perform common data analysis tasks in MATLAB, including smoothing data and fitting polynomials.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Analyzing Electricity Consumption<br>Moving Window Operations<br>Linear Correlation<br>Polynomial Fitting<br>Summary of Common Data Analysis Techniques<br>Programming Constructs170 min<br>Create flexible code that can interact with the user, make decisions, and adapt to different situations.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Comparing Prices<br>User Interaction<br>Decision Branching<br>Determining Size<br>For Loops<br>While Loops<br>Summary of Programming Constructs<br>Increasing Automation with Functions90 min<br>Increase automation by encapsulating modular tasks as user-defined functions. Understand how MATLAB resolves references to files and variables.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Electricity Consumption in Different Sectors<br>Creating and Calling Functions<br>Function Files<br>Workspaces<br>MATLAB Path and Calling Precedence<br>Summary of Functions<br>Troubleshooting Code35 min<br>Explore MATLAB tools for debugging and measuring code performance.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Course Example &#8211; Debugging<br>Code Analyzer<br>Debugging Run-Time Errors<br>Summary of Troubleshooting Code<br>Review Project II15 min<br>Tie together several topics covered in the course<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Project &#8211; Review of Fundamentals<br>Conclusion5 min<br>Learn next steps and give feedback on the course.<\/p>\n\n\n\n<p><strong>Lessons:<\/strong><br>Additional Resources<br>Survey<\/p>\n\n\n\n<p><strong>MATLAB Fundamentals<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Working with the MATLAB User Interface<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Become familiar with the main features of the MATLAB integrated design environment and its user interfaces. Get an overview of course themes.Reading data from filesSaving and loading variablesPlotting dataCustomizing plotsExporting graphics for use in other applications<\/td><\/tr><tr><td><strong>Variables and Commands<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Enter MATLAB commands, with an emphasis on creating variables, accessing and manipulating data in variables, and creating basic visualizations. Collect MATLAB commands into scripts for ease of reproduction and experimentation.Entering commandsCreating numeric and character variablesMaking and annotating plotsGetting helpCreating and running live scripts<\/td><\/tr><tr><td><strong>Analysis and Visualization with Vectors<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Perform mathematical and statistical calculations with vectors. Use MATLAB syntax to perform calculations on whole data sets with a single command. Organize scripts into logical sections for development, maintenance, and publishing.Performing calculations with vectorsAccessing and modifying values in vectorsFormatting and sharing live scripts<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Analysis and Visualization with Matrices<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use matrices as mathematical objects or as collections of (vector) data. Understand the appropriate use of MATLAB syntax to distinguish between these applications.Creating and manipulating matricesPerforming calculations with matricesCalculating statistics with matrix dataVisualizing matrix data<\/td><\/tr><tr><td><strong>Tables of Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Import data as a MATLAB table. Work with data stored as a table.Storing data as a tableOperating on tablesExtracting data from tablesModifying tables<\/td><\/tr><tr><td><strong>Conditional Data Selection<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Extract and analyze subsets of data that satisfy given criteria.Logical operations and variablesFinding and countingLogical indexing<\/td><\/tr><tr><td><strong>Organizing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Organize table data for analysis. Represent data using appropriate native MATLAB data types.Combining tables of dataTable metadataDates and durationsDiscrete categories<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Analyzing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Perform typical data analysis tasks in MATLAB, including importing data from files, preprocessing data, fitting a model to data, and creating a customized visualization of the model.Importing from spreadsheets and delimited text filesDealing with missing dataPlotting functionsCustomizing plots<\/td><\/tr><tr><td><strong>Increasing Automation with Programming Constructs<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Create flexible code that can interact with the user, make decisions, and adapt to different situations.Programming constructsUser interactionDecision branchingLoops<\/td><\/tr><tr><td><strong>Increasing Automation with Functions<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Increase automation by encapsulating modular tasks as user-defined functions. Understand how MATLAB resolves references to files and variables. Use MATLAB development tools to find and correct problems with code.Creating functionsCalling functionsSetting the MATLAB pathDebuggingUsing breakpointsCreating and using structures<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u0e04\u0e48\u0e32\u0e40\u0e23\u0e35\u0e22\u0e19 MATLAB for Data Processing and Visualization<\/strong> Virtual 750 USD \/200 USD (2021)<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Importing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Read text files that contain a mixture of data types, delimiters, and headers.Import a mixture of data types from arbitrarily formatted text filesImport only required columns of data from a text fileImport and merge data from multiple files<\/td><\/tr><tr><td><strong>Processing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Process raw imported data by extracting, manipulating, aggregating, and counting portions of data.Process data with missing elementsCreate and modify categorical arraysAggregate, bin, and count groups of data<\/td><\/tr><tr><td><strong>Customizing Visualizations<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Annotate and modify standard plots to produce informative customized graphics.Determine properties of graphics objects and their associated valuesLocate and manipulate graphics objectsCustomize plots by modifying properties of graphics objects<\/td><\/tr><tr><td><strong>Working with Irregular Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Import and visualize scattered data from text files with irregular formatting.Parse text files to determine formattingImport data from separate sections of a text fileExtract data from container variablesInterpolate irregularly spaced three-dimensional dataVisualize three-dimensional data in two and three dimensions<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Further study<\/strong><br>https:\/\/www.mathworks.com\/matlabcentral\/answers\/<br>https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/<br>https:\/\/www.mathworks.com\/help\/index.html<br>https:\/\/www.mathworks.com\/content\/dam\/mathworks\/fact-sheet\/matlab-basic-functions-reference.pdf<br> https:\/\/www.mathworks.com\/services\/training\/courses.html<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">1. Getting Started<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Getting Started<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Creating Variables<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-1.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6357\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-5.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6358\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6359\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-7.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6360\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Modifying Variables<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>You can use the&nbsp;<strong>Up<\/strong>&nbsp;(\u2191) and&nbsp;<strong>Down<\/strong>&nbsp;(\u2193) arrows on the keyboard to scroll through previous commands.<\/td><\/tr><tr><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/06427560-6f35-4305-a083-4120a6c998cf\" alt=\"keyboard arrows\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Cleaning Up<\/h2>\n\n\n\n<p><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/clear.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>clear<\/code><\/a>Clears variables from the workspace.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/clc.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>clc<\/code><\/a>Clears the Command Window and moves the cursor to the upper left corner of the window.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Import Tool<\/h2>\n\n\n\n<p>You can use the Import Tool to interactively bring your data into MATLAB.<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Saving and Loading Data<\/h2>\n\n\n\n<p>You can save and load MAT-files programmatically using the&nbsp;<code>save<\/code>&nbsp;and&nbsp;<code>load<\/code>&nbsp;commands.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Creates&nbsp;<code>myData.mat<\/code>&nbsp;containing current workspace variables.<\/td><td><\/td><td>save myData<\/td><\/tr><tr><td>Instead of saving the entire MATLAB workspace, you can selectively save individual variables. Saves&nbsp;<code>x<\/code>&nbsp;and&nbsp;<code>y<\/code>&nbsp;to&nbsp;<code>someFile.mat<\/code>.<\/td><td><\/td><td>save someFile x y<\/td><\/tr><tr><td>Loads variables from&nbsp;<code>myData.mat<\/code>&nbsp;into current workspace.<\/td><td><\/td><td>load myData<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/save.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>save<\/code><\/a>Saves workspace variables to a MAT-file.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/load.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>load<\/code><\/a>Loads variables from a MAT-file into the workspace.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Obtaining Help<\/h2>\n\n\n\n<p>You can access the documentation with the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/doc.html\" rel=\"noreferrer noopener\"><code>doc<\/code><\/a>&nbsp;function at the command line or from the toolstrip.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/e33743cf-e9e8-4f75-83a9-c40d3530bc34\" alt=\"three ways to access the documentation\">You can filter search results by product and type of page.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/df3a87dc-8d33-4d9c-b752-b6582588b086\" alt=\"search results\">Documentation pages for functions have information organized with increasing levels of detail.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/ca75aeba-7170-4fc5-84f1-f5c576398780\" alt=\"anatomy of function documentation\"><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2. Plotting and Common Modifications<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Plotting and Common Modifications<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Here, the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/plot.html\" rel=\"noreferrer noopener\"><code>plot<\/code><\/a>&nbsp;function plots&nbsp;<code>Germany<\/code>&nbsp;against&nbsp;<code>Year<\/code>.<\/td><td><\/td><td>plot(Year,Germany)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/fcbe3da7-fc21-41eb-93a5-274d2670757b\" alt=\"Plot of Germany Against Year\"><br><br><\/td><\/tr><tr><td>You can also use an optional line specification string to change properties of the plot.<br><br>To see options for line style, line color, and marker style, reference the documentation for<br>\u201c<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/linespec.html\">Line Specification<\/a>\u201d.<\/td><td><\/td><td>plot(Australia,Germany,&#8221;mo&#8221;)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/23cf2241-4107-49c3-99a8-7661b5e3b863\" alt=\"Plot of Germany Against Australia\"><br><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The&nbsp;<code>hold&nbsp;on<\/code>&nbsp;command allows you to plot multiple data sets together on the same axes.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/86843638-7767-4be1-acdd-32093a9c7a2b\" alt=\"hold on and hold off\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Annotating Plots<\/h2>\n\n\n\n<p>Textual information can be added to plots using separate annotation functions. All of these functions take text input.<br><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/title.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>title<\/code><\/a>Add title to plot<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/xlabel.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>xlabel<\/code><\/a>Label the x-axis<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/ylabel.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>ylabel<\/code><\/a>Label the y-axis<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/legend.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>legend<\/code><\/a>Add legend to plot<br>Grid lines can be added or removed to plots.<br><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/grid.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>grid<\/code><\/a>Display axes grid lines<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">title(\"Gasoline Prices\")\nxlabel(\"Year\")\nylabel(\"Price (USD\/L)\")\nlegend(\"Germany\",\"Australia\",\"Mexico\",...\n    \"Location\",\"northwest\")\ngrid on<\/pre>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Axis Control<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Get Axes Limits<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"> v = axis\n\n v =\n     0  12  0.1  0.9\n            <\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-4.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6353\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Custom Axis Limits<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"> xlim([-1 13])    &nbsp;\n ylim([-1 2])\n            <\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-2.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6351\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Axis Limits = Data Range<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"> axis tight\n            <\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-9.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6356\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Exporting a Figure<\/h2>\n\n\n\n<p>You can either copy and paste output or export a figure as an image file.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/6d62fb1b-0b44-4702-a0e0-9ee46c5e30f3\" alt=\"copy and paste a figure\"><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">3. Working with Live Scripts<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Working with Live Scripts<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Create and Run a Script<\/h2>\n\n\n\n<p>Use the controls in the MATLAB toolstrip to create and run scripts.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><th>Create<\/th><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/8c1b06a9-fe4b-491b-879c-3c4177be2b27\"><\/td><td><\/td><th>Run<\/th><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/4c37edeb-e763-4b19-8f7b-d32b283afd93\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Code Sections<\/h2>\n\n\n\n<p>Code sections allow you to organize your code and run sections of code independently. On the&nbsp;<strong>Live Editor<\/strong>&nbsp;tab, in the&nbsp;<strong>Section<\/strong>&nbsp;section, click&nbsp;<strong>Section Break<\/strong>&nbsp;to create a new code section, or press&nbsp;<strong>Ctrl+Alt+Enter<\/strong>.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/4bae0ee5-7a05-4945-9cf9-98e6b8d851eb\" alt=\"code sections in live editor\">You can run and add code sections in the&nbsp;<strong>Section<\/strong>&nbsp;section of the&nbsp;<strong>Live Editor<\/strong>&nbsp;tab in the toolstrip.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/b2908cc6-2707-4bdd-ad61-44381b330d48\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Comments and Text<\/h2>\n\n\n\n<p>To insert a line of text, click the&nbsp;<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/235db623-554d-4808-bbb8-588f3dde1fb0\"><strong>Text<\/strong>&nbsp;button in the&nbsp;<strong>Text<\/strong>&nbsp;section of the&nbsp;<strong>Live Editor<\/strong>&nbsp;tab in the MATLAB Toolstrip.<\/p>\n\n\n\n<p>Format the text using the formatting options provided in the&nbsp;<strong>Text<\/strong>&nbsp;section.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/9fe41b61-924a-44ea-8c59-edea3646dc5f\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Comments<\/h3>\n\n\n\n<p>To create a comment, add&nbsp;<code>%&nbsp;<em>comment<\/em><\/code>&nbsp;where you want to add more information.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">load AuDeMx\n% Converts from US$\/gal to US$\/L\ngal2lit = 0.2642;  &nbsp;&nbsp;% conversion factor\nGermany = gal2lit*Germany;\nAustralia = gal2lit*Australia;\nMexico = gal2lit*Mexico;\n    <\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Exporting Live Script Files<\/h1>\n\n\n\n<p>You can export your live script and results using the&nbsp;<strong>Save<\/strong>&nbsp;button in the&nbsp;<strong>Live Editor<\/strong>&nbsp;tab.<\/p>\n\n\n\n<p>Available formats include PDF, Word, HTML, and LaTeX.<\/p>\n\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">4. Creating and Manipulating Arrays<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Creating and Manipulating Arrays<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Manually Entering Arrays<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Row Vector<\/h3>\n\n\n\n<p>Use square brackets and separate the values using a comma or a space.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [10 15 20 25]\n\na =\n     10  15  20  25<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Column Vector<\/h3>\n\n\n\n<p>Use square brackets and separate the values using a semi-colon.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">b = [2;3;5;7]\n\nb =\n     2\n     3\n     5\n     7<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Transpose a Vector<\/h3>\n\n\n\n<p>Use the transpose operator&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">'<\/pre>\n\n\n\n<p>.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">c = b'\n\nc =\n     2  3  5  7<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Matrix<\/h3>\n\n\n\n<p>Use square brackets and enter values row-by-row. Separate values in a row using a comma or a space, and use a semicolon to start a new row.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">A = [1 3 5;2 4 6]\n\nA =\n     1  3  5\n     2  4  6<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Creating Evenly-Spaced Vectors<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Given the Start Value, End Value, and Interval<\/h3>\n\n\n\n<p>Use the colon operator to separate the starting value, interval, and the ending value.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = 3:2:7\n\na =\n     3  5  7<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">When Interval is 1<\/h3>\n\n\n\n<p>Use the colon operator to separate the starting and the ending value.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">b = 3:7\n\nb =\n     3  4  5  6  7<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Given the Start Value, End Value, and Number of Elements<\/h3>\n\n\n\n<p>Use the function&nbsp;<code>linspace<\/code>&nbsp;when the number of elements in the vector are known.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">c = linspace(3.2,8.1,5)\n\nc =\n     3.2  4.42  5.65  6.87  8.1<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Concatenating Arrays<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Horizontal Concatenation<\/h3>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/c333aba6-45ad-49a1-a41e-448d539dad76\" alt=\"horizontal concatenation using a space\">Separate elements using a&nbsp;<strong>comma (,)<\/strong>&nbsp;or&nbsp;<strong>space (&nbsp;&nbsp;)<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vertical Concatenation<\/h3>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/4bc54fb6-0e8d-40fc-b3d8-564e555b8a3e\" alt=\"vertical concatenation using a semicolon\">Separate elements using a&nbsp;<strong>semicolon (;)<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Combined Concatenation<\/h3>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/b523220c-2cc9-4a9a-acec-c2b979ddb2ac\" alt=\"vertical and horizontal concatenation\">Create each row separating elements with a&nbsp;<strong>comma (,)<\/strong>&nbsp;or&nbsp;<strong>space (&nbsp;&nbsp;)<\/strong>, then separate the rows with a&nbsp;<strong>semicolon (;)<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Array Creation Functions<\/h2>\n\n\n\n<p>Several functions exist that allow you to create arrays.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-3.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6363\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-2.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6362\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Most of these functions support the calling syntaxes shown below.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Calling syntax<\/th><th>Output<\/th><\/tr><\/thead><tbody><tr><td><code><em>fun<\/em>(<em>m<\/em>,<em>n<\/em>)<\/code><\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/98f3e1bd-ce1d-4010-934a-401a5dabce3f\">m-by-n<\/td><\/tr><tr><td><code><em>fun<\/em>(<em>n<\/em>)<\/code><\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/21001ced-2c56-42c4-b34b-6191789fe661\">n-by-n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Reshaping Arrays<\/h2>\n\n\n\n<p>The following column of information is reshaped into a matrix.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/969fba0d-77b6-4c16-9f72-aaae8212435c\" alt=\"reshaping indexes\"><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td>x = rand(260,1);<\/td><\/tr><tr><td>Specify the dimensions for the new array.<\/td><td><\/td><td>y = reshape(x,5,52);<\/td><\/tr><tr><td>For convenience, you can also leave one of the dimensions blank when calling&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/reshape.html\" rel=\"noreferrer noopener\"><code>reshape<\/code><\/a>&nbsp;and that dimension will be calculated automatically.<\/td><td><\/td><td>y = reshape(x,5,[]);<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">5. Accessing Data in Arrays<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Accessing Data in Arrays<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Indexing into Vectors<\/h2>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/39e09367-0235-42ea-befb-cefb0a9b7c6d\" alt=\"vector indexing\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Indexing into Matrices<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Row, Column Indexing<\/h3>\n\n\n\n<p>Whether you&#8217;re indexing into a matrix with scalar values or vector values, the format is always the same.Use the row number to index.<\/p>\n\n\n\n<p>If multiple rows are to be extracted, create a&nbsp;<strong>vector<\/strong>&nbsp;containing the row numbers and use that as the row index.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(<em>row<\/em>,<em>column<\/em>)<\/pre>\n\n\n\n<p>Use the column number or a vector of column numbers to be extracted as the column index.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(<em>row<\/em>,<em>column<\/em>)<\/pre>\n\n\n\n<p>This is row-<strong>comma<\/strong>-column indexing. Separate the row index and column index by a comma.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(<em>row<\/em>,<em>column<\/em>)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Extract a single element<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(2,3)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/02353c0a-7615-4e73-b915-89a91e9b8816\"><code>M<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Extract multiple elements<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(2,[3 4])<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/e14f116f-584d-49f4-b777-2598d7f073d2\"><code>M<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Extract multiple contiguous elements<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(2,2:4)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/b8ffd3ce-c7db-46f6-8430-098dbd5fbe86\"><code>M<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Extract complete rows or columns<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">output = M(2,:)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/817341bc-ed0a-408e-8d71-c9277bf99b6c\"><code>M<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">6. Mathematical and Statistical Operations with Arrays<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Mathematical and Statistical Operations with Arrays<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Performing Operations on Arrays<\/h2>\n\n\n\n<p>There are many operators that behave in element-wise manner, i.e., the operation is performed on each element of the array individually.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mathematical Functions<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-3.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6352\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Other Similar Functions<\/th><\/tr><\/thead><tbody><tr><td><code>sin<\/code><\/td><td>Sine<\/td><\/tr><tr><td><code>cos<\/code><\/td><td>Cosine<\/td><\/tr><tr><td><code>log<\/code><\/td><td>Logarithm<\/td><\/tr><tr><td><code>round<\/code><\/td><td>Rounding Operation<\/td><\/tr><tr><td><code>sqrt<\/code><\/td><td>Square Root<\/td><\/tr><tr><td><code>mod<\/code><\/td><td>Modulus<\/td><\/tr><tr><td>Many more<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Scalar Expansion<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-1.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6361\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Operators<\/th><\/tr><\/thead><tbody><tr><td><code>+<\/code><\/td><td>Addition<\/td><\/tr><tr><td><code>-<\/code><\/td><td>Subtraction<\/td><\/tr><tr><td><code>*<\/code><\/td><td>Multiplication<\/td><\/tr><tr><td><code>\/<\/code><\/td><td>Division<\/td><\/tr><tr><td><code>^<\/code><\/td><td>Exponentiation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Arithmetic Operators<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-8.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6354\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Operators<\/th><\/tr><\/thead><tbody><tr><td><code>+<\/code><\/td><td>Addition<\/td><\/tr><tr><td><code>-<\/code><\/td><td>Subtraction<\/td><\/tr><tr><td><code>.*<\/code><\/td><td>Element-wise Multiplication<\/td><\/tr><tr><td><code>.\/<\/code><\/td><td>Element-wise Division<\/td><\/tr><tr><td><code>.^<\/code><\/td><td>Element-wise Exponentiation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Note that, for performing the arithmetic operations on two matrices, they should have identical dimensions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implicit Expansion<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-6.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6355\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Operators<\/th><\/tr><\/thead><tbody><tr><td><code>+<\/code><\/td><td>Addition<\/td><\/tr><tr><td><code>-<\/code><\/td><td>Subtraction<\/td><\/tr><tr><td><code>.*<\/code><\/td><td>Element-wise Multiplication<\/td><\/tr><tr><td><code>.\/<\/code><\/td><td>Element-wise Division<\/td><\/tr><tr><td><code>.^<\/code><\/td><td>Element-wise Exponentiation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Array operations can be performed on operands of different&nbsp;<em>compatible<\/em>&nbsp;sizes. Two arrays have compatible sizes if the size of each dimension is either the same or one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Calculating Statistics of Vectors<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Common Statistical Functions<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>min<\/code><\/td><td>Returns the minimum element<\/td><\/tr><tr><td><code>max<\/code><\/td><td>Returns the maximum element<\/td><\/tr><tr><td><code>mean<\/code><\/td><td>Returns the average of the elements<\/td><\/tr><tr><td><code>median<\/code><\/td><td>Returns the median value of the elements<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Using&nbsp;<code>min<\/code>&nbsp;and&nbsp;<code>max<\/code><\/h3>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/a672d39c-8e4b-49ab-8737-6a3cd9bc79f9\" alt=\"min with 2 outputs\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ignoring NaNs<\/h3>\n\n\n\n<p>When using statistical functions, you can ignore NaN values<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  avg = mean(v,\"omitnan\")<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Statistical Operations on Matrices<\/h2>\n\n\n\n<p>Some common mathematical functions which calculate a value for each column in a matrix include:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Behavior<\/th><\/tr><\/thead><tbody><tr><td><code>max<\/code><\/td><td>Largest elements<\/td><\/tr><tr><td><code>min<\/code><\/td><td>Smallest elements<\/td><\/tr><tr><td><code>mean<\/code><\/td><td>Average or mean value<\/td><\/tr><tr><td><code>median<\/code><\/td><td>Median value<\/td><\/tr><tr><td><code>mode<\/code><\/td><td>Most frequent values<\/td><\/tr><tr><td><code>std<\/code><\/td><td>Standard deviation<\/td><\/tr><tr><td><code>var<\/code><\/td><td>Variance<\/td><\/tr><tr><td><code>sum<\/code><\/td><td>Sum of elements<\/td><\/tr><tr><td><code>prod<\/code><\/td><td>Product of elements<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td>A = [8 2 4 ; 3 2 6 ; 7 5 3 ; 7 10 8] A = 8 2 4 3 2 6 7 5 3 7 10 8<\/td><\/tr><tr><td><\/td><td><\/td><td>Amax = max(A) Amax = 8 10 8<\/td><\/tr><tr><td><\/td><td><\/td><td>Astd = std(A) Astd = 2.2174 3.7749 2.2174<\/td><\/tr><tr><td><\/td><td><\/td><td>Asum = sum(A) Asum = 25 19 21<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Many statistical functions accept an optional dimensional argument that specifies whether the operation should be applied to columns independently (the default) or to rows.<br><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/9286e3d5-8e07-4ca0-9e54-99b222bf27ee\" alt=\"cols and rows\"><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; M = mean(A,dim)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>M<\/code><\/td><td>Vector of average values along dimension&nbsp;<code>dim<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>A<\/code><\/td><td>Matrix<\/td><\/tr><tr><td><code>dim<\/code><\/td><td>Dimension across which the mean is taken.<br><code>1<\/code>: the mean of each column<br><code>2<\/code>: the mean of each row<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Matrix Multiplication<\/h2>\n\n\n\n<p>Matrix multiplication requires that the inner dimensions agree. The resultant matrix has the outer dimensions.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/e9d7f680-d2c2-4de2-913b-a2b954f6ac3e\" alt=\"inner dimensions\"><br><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/d3413df6-fe53-40cc-934a-9539e1b02a30\" alt=\"outer dimensions\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solving Systems of Linear Equations<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Expression<\/th><th>Interpretation<\/th><\/tr><\/thead><tbody><tr><td>x = B\/A<\/td><td>Solves&nbsp;<code>x*A&nbsp;=&nbsp;B<\/code>&nbsp;(for&nbsp;<code>x<\/code>)<\/td><\/tr><tr><td>x = A\\B<\/td><td>Solves&nbsp;<code>A*x&nbsp;=&nbsp;B<\/code>&nbsp;(for&nbsp;<code>x<\/code>)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">7. Visualizing Data in 2D and 3D<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Visualizing Data in 2D and 3D<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Identifying Available Plot Types<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>scatter<\/code><\/td><td>Scatter plot, with variable marker size and color<\/td><\/tr><tr><td><code>bar<\/code><\/td><td>Bar graph (vertical and horizontal)<\/td><\/tr><tr><td><code>stem<\/code><\/td><td>Discrete sequence (signal) plot<\/td><\/tr><tr><td><code>stairs<\/code><\/td><td>Stairstep graph<\/td><\/tr><tr><td><code>area<\/code><\/td><td>Filled area plot<\/td><\/tr><tr><td><code>pie<\/code><\/td><td>Pie chart<\/td><\/tr><tr><td><code>histogram<\/code><\/td><td>Histogram<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>See the complete list of all available plots&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/creating_plots\/types-of-matlab-plots.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Annotating with Multiple Strings of Text<\/h2>\n\n\n\n<p>Arrays of strings are useful for annotating visualizations. Use square brackets,&nbsp;<code>[]<\/code>, with spaces and semicolons,&nbsp;<code>;<\/code>&nbsp;to create a string array the same way you create a numeric matrix.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        x = [\"hello\" \"sweet\";\"peaceful\" \"world\"]\n        x =\n            2\u00d72 <strong>string<\/strong> array\n            \"hello\"      \"sweet\"\n            \"peaceful\"   \"world\"\n    <\/pre>\n\n\n\n<p><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/xticks.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>xticks<\/code><\/a>Sets tick locations along the x-axis.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/xticklabels.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>xticklabels<\/code><\/a>Labels the x-axis ticks.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/xtickangle.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>xtickangle<\/code><\/a>Rotates the x-axis tick labels.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Customizing Plot Properties<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Specifying Property Values<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">plot(x,y,linespec,<em>Property1<\/em>,<em>Value1<\/em>,<em>Property2<\/em>,<em>Value2<\/em>,<em>Property3<\/em>,<em>Value3<\/em>,...)<\/pre>\n\n\n\n<p>Common line properties to modify:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>\"LineWidth\"<\/code>&nbsp;(width of the line and marker edges)<\/li><li><code>\"MarkerSize\"<\/code>&nbsp;(size of the marker symbols)<\/li><li><code>\"MarkerEdgeColor\"<\/code>&nbsp;(color of the edge of the marker symbols)<\/li><li><code>\"MarkerFaceColor\"<\/code>&nbsp;(color of the interior of the marker symbols)<\/li><li><code>\"Color\"<\/code>&nbsp;(color of the line, particularly when given as RGB values)<\/li><\/ul>\n\n\n\n<p><a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.graphics.primitive.line-properties.html\" rel=\"noreferrer noopener\">MATLAB Line Properties reference<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Specifying Colors<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>red (<code>\"r\"<\/code>)<\/td><td>green (<code>\"g\"<\/code>)<\/td><td>blue (<code>\"b\"<\/code>)<\/td><td>black (<code>\"k\"<\/code>)<\/td><\/tr><tr><td>magenta (<code>\"m\"<\/code>)<\/td><td>yellow (<code>\"y\"<\/code>)<\/td><td>cyan (<code>\"c\"<\/code>)<\/td><td>white (<code>\"w\"<\/code>)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Or as a vector&nbsp;<code>[R&nbsp;G&nbsp;B]<\/code>&nbsp;where each value is from 0 to 1.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plotting Multiple Columns<\/h2>\n\n\n\n<p>You can use the&nbsp;<code>plot<\/code>&nbsp;function on a matrix to plot each column as a separate line in your plot.<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/ff196926-1545-433a-bca6-3b8743f4cb1e\" alt=\"plotting each month separately\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Visualizing Matrices<\/h2>\n\n\n\n<p>You can use visualization functions to plot your three-dimensional data.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>z<\/code>&nbsp;is a 5-by-5 matrix<\/td><td><\/td><td>zz = 0 0 0 0 0 0 0 -6 0 0 0 -3 1 3 0 0 0 8 1 0 0 0 0 0 0<\/td><\/tr><tr><td>The&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/surf.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>surf<\/code><\/a>&nbsp;function plots each point&nbsp;<code>z(j,k)<\/code>&nbsp;over the point&nbsp;<em>x<\/em>=<code>k<\/code>&nbsp;and&nbsp;<em>y<\/em>=<code>j<\/code><\/td><td><\/td><td>surf(z)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/0655e2a7-7521-4810-9c01-d721f6c7d085\"><\/td><\/tr><tr><td>To specify&nbsp;<em>x<\/em>&nbsp;and&nbsp;<em>y<\/em>&nbsp;coordinates, you can pass them in as vectors. Here,The number of elements of&nbsp;<code>x<\/code>&nbsp;must match the number of columns of&nbsp;<code>z<\/code>The number of elements of&nbsp;<code>y<\/code>&nbsp;must match the number of rows of&nbsp;<code>z<\/code><\/td><td><\/td><td>x = 11:15; y = 21:25; surf(x,y,z)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/c03bb272-812a-4a6e-90f5-cf4ae7c9c4b2\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">8. Conditional Data Selection<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Conditional Data Selection<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Logical Operations and Variables<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Relational Operators<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>==<\/code><\/td><td>Equal<\/td><\/tr><tr><td><code>&gt;<\/code><\/td><td>Greater than<\/td><\/tr><tr><td><code>&lt;<\/code><\/td><td>Less than<\/td><\/tr><tr><td><code>&gt;=<\/code><\/td><td>Greater than or equal<\/td><\/tr><tr><td><code>&lt;=<\/code><\/td><td>Less than or equal<\/td><\/tr><tr><td><code>~=<\/code><\/td><td>Not equal<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">v = [6 7 8 9];\nw = [2 4 8 16];\nNE = v ~= w\nNE =\n    1  1  0  1<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Logical Operators<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>&amp;<\/code><\/td><td>AND<\/td><\/tr><tr><td><code>|<\/code><\/td><td>OR<\/td><\/tr><tr><td><code>~<\/code><\/td><td>NOT<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">v = [6 7 8 9];\nw = [2 4 8 16];\nx = 5;\nA = (v &gt; x) &amp; (w &gt; x)\nA =\n    0  0  1  1<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Counting Elements<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Purpose<\/th><th>Function<\/th><th>Output<\/th><\/tr><\/thead><tbody><tr><td>Are any of the elements true?<\/td><td><a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/any.html\" rel=\"noreferrer noopener\"><code>any<\/code><\/a><\/td><td>true\/false<\/td><\/tr><tr><td>Are all the elements true?<\/td><td><a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/all.html\" rel=\"noreferrer noopener\"><code>all<\/code><\/a><\/td><td>true\/false<\/td><\/tr><tr><td>How many elements are true?<\/td><td><a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/nnz.html\" rel=\"noreferrer noopener\"><code>nnz<\/code><\/a><\/td><td>double<\/td><\/tr><tr><td>What are the indices of the elements that are true?<\/td><td><a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/find.html\" rel=\"noreferrer noopener\"><code>find<\/code><\/a><\/td><td>double<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Logical Indexing<\/h2>\n\n\n\n<p><strong>Purpose:<\/strong>&nbsp;Select the elements of an array based on certain criteria.&nbsp;<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/e7c538c7-87f5-4065-8f28-c4c1518e422c\" alt=\"x and y\"><br><strong>Step 1:<\/strong>&nbsp;Create a logical vector by evaluating the given condition.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  idx = x &gt; 4<\/pre>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/28002106-a35d-4457-8f2d-af90cc9e5e8e\" alt=\"x and y\"><br><strong>Step 2:<\/strong>&nbsp;Use the logical vector as an index into another array to extract the elements corresponding to the true values.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>idx = x &gt; 4<br>z = y(idx)<\/td><td>or<\/td><td>z = y(x &gt; 4)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">  <\/pre>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/9c5d74cb-7d0e-4b6e-8b20-8ae6145a0f30\" alt=\"x and y\"><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">9. Review Project I<\/h1>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">10. Tables of Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Tables of Data<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Storing Data in a Table<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/readtable.html\" rel=\"noreferrer noopener\"><code>readtable<\/code><\/a>&nbsp;function creates a table in MATLAB from a data file.<\/td><td><\/td><td>EPL = readtable(&#8220;EPLresults.xlsx&#8221;,&#8221;TextType&#8221;,&#8221;string&#8221;);<\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/table.html\" rel=\"noreferrer noopener\"><code>table<\/code><\/a>&nbsp;function can create a table from workspace variables.<\/td><td><\/td><td>teamWinsTable = table(team,wins)teamWins = <strong>Team<\/strong> <strong>Wins<\/strong> ___________________ ____ &#8220;Arsenal&#8221; 20 &#8220;Chelsea&#8221; 12 &#8220;Leicester City&#8221; 23 &#8220;Manchester United&#8221; 19<\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/array2table.html\" rel=\"noreferrer noopener\"><code>array2table<\/code><\/a>&nbsp;function can convert a numeric array to a table. The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/array2table.html#input_argument_namevalue_variablenames\" rel=\"noreferrer noopener\"><code>VariableNames<\/code><\/a>&nbsp;property can be specified as a cell array of names to include as variable names in the table.<\/td><td><\/td><td>stats = array2table(wdl, &#8230; &#8220;VariableNames&#8221;,[&#8220;Wins&#8221; &#8220;Draws&#8221; &#8220;Losses&#8221;])stats = <strong>Wins<\/strong> <strong>Draws<\/strong> <strong>Losses<\/strong> ____ _____ ______ 20 11 7 12 14 12 23 12 3 19 9 10<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Sorting Table Data<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/sortrows.html\" rel=\"noreferrer noopener\"><code>sortrows<\/code><\/a>&nbsp;function sorts the data in ascending order, by default.<\/td><td><\/td><td>EPL = sortrows(EPL,&#8221;HomeWins&#8221;);<\/td><\/tr><tr><td>Use the optional&nbsp;<code>\"descend\"<\/code>&nbsp;parameter to sort the list in descending order.<\/td><td><\/td><td>EPL = sortrows(EPL,&#8221;HomeWins&#8221;,&#8221;descend&#8221;);<\/td><\/tr><tr><td>You can also sort on multiple variables, in order, by specifying a cell array of variable names.<\/td><td><\/td><td>EPL = sortrows(EPL,[&#8220;HomeWins&#8221; &#8220;AwayWins&#8221;],&#8221;descend&#8221;);<\/td><\/tr><tr><td>You can also show&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/summary.html\" rel=\"noreferrer noopener\"><code>summary<\/code><\/a>&nbsp;statistics for variables in a table.<\/td><td><\/td><td>summary(EPL)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Extracting Portions of a Table<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Display the original table.<\/td><td><\/td><td>EPLEPL = <strong>Team<\/strong> <strong>HW<\/strong> <strong>HD<\/strong> <strong>HL<\/strong> <strong>AW<\/strong> <strong>AD<\/strong> <strong>AL<\/strong> ___________________ __ __ __ __ __ __ &#8220;Leicester City&#8221; 12 6 1 11 6 2 &#8220;Arsenal&#8221; 12 4 3 8 7 4 &#8220;Manchester City&#8221; 12 2 5 7 7 5 &#8220;Manchester United&#8221; 12 5 2 7 4 8 &#8220;Chelsea&#8221; 5 9 5 7 5 7 &#8220;Bournemouth&#8221; 5 5 9 6 4 9 &#8220;Aston Villa&#8221; 2 5 12 1 3 15<\/td><\/tr><tr><td>Inside parenthesis, specify the row numbers of the observations and column numbers of the table variables you would like to select.<\/td><td><\/td><td>EPL(2:4,[1 2 5])ans = <strong>Team HW AW<\/strong> ___________________ __ __ &#8220;Arsenal&#8221; 12 8 &#8220;Manchester City&#8221; 12 7 &#8220;Manchester United&#8221; 12 7<\/td><\/tr><tr><td>You may also use the name of the variable for indexing.<br><br>If you want to reference more than one variable, use a cell array containing the variable names.<\/td><td><\/td><td>EPL(2:4,[&#8220;Team&#8221; &#8220;HW&#8221; &#8220;AW&#8221;])ans = <strong>Team HW AW<\/strong> ___________________ __ __ &#8220;Arsenal&#8221; 12 8 &#8220;Manchester City&#8221; 12 7 &#8220;Manchester United&#8221; 12 7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Extracting Data from a Table<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Display the original table.<\/td><td><\/td><td>EPLEPL = <strong>Team<\/strong> <strong>HW<\/strong> <strong>HD<\/strong> <strong>HL<\/strong> <strong>AW<\/strong> <strong>AD<\/strong> <strong>AL<\/strong> ___________________ __ __ __ __ __ __ &#8220;Leicester City&#8221; 12 6 1 11 6 2 &#8220;Arsenal&#8221; 12 4 3 8 7 4 &#8220;Manchester City&#8221; 12 2 5 7 7 5 &#8220;Manchester United&#8221; 12 5 2 7 4 8<\/td><\/tr><tr><td>You can use dot notation to extract data for use in calculations or plotting.<\/td><td><\/td><td>tw = EPL.HW + EPL.AWtw = 23 20 19 19<\/td><\/tr><tr><td>You can also use dot notation to create new variables in a table.<\/td><td><\/td><td>EPL.TW = EPL.HW + EPL.AWEPL = <strong>Team HW HD HL AW AD AL TW<\/strong> ___________________ __ __ __ __ __ __ __ &#8220;Leicester City&#8221; 12 6 1 11 6 2 23 &#8220;Arsenal&#8221; 12 4 3 8 7 4 20 &#8220;Manchester City&#8221; 12 2 5 7 7 5 19 &#8220;Manchester United&#8221; 12 5 2 7 4 8 19<\/td><\/tr><tr><td>If you want to extract multiple variables, you can do this using curly braces.<\/td><td><\/td><td>draws = EPL{:,[&#8220;HD&#8221; &#8220;AD&#8221;]}draws = 6 6 4 7 2 7 5 4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Exporting Tables<\/h2>\n\n\n\n<p>You can use the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/writetable.html\" rel=\"noreferrer noopener\"><code>writetable<\/code><\/a>&nbsp;function to create a file from a table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">   writetable(<em>tableName<\/em>,\"myFile.txt\",\"Delimeter\",\"\\t\")\n    <\/pre>\n\n\n\n<p>The file format is based on the file extension, such as&nbsp;<code>.txt<\/code>,&nbsp;<code>.csv<\/code>, or&nbsp;<code>.xlsx&nbsp;<\/code>, but you can also specify a delimeter.<br><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/writetable.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>writetable<\/code><\/a>Write a table to a file.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">11. Organizing Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Organizing Data<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Combining Tables<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Display the original tables.<\/td><td><\/td><td>EPLEPL = <strong>Team Points<\/strong> <strong>___________________ ______<\/strong> &#8220;Leicester City&#8221; 81 &#8220;Arsenal&#8221; 71 &#8220;Aston Villa&#8221; 17gamesgames = <strong>Wins ____<\/strong> 23 20 3teamInfoteamInfo = <strong>Team Manager ________________ _________________<\/strong> &#8220;Arsenal&#8221; &#8220;Ars\u00e8ne Wenger&#8221; &#8220;Aston Villa&#8221; &#8220;Eric Black&#8221; &#8220;Leicester City&#8221; &#8220;Claudio Ranieri&#8221;<\/td><\/tr><tr><td>You can concatenate tables that are the same length but do not share a common variable.<\/td><td><\/td><td>[EPL games]ans = <strong>Team Points Wins ________________ ______ ____<\/strong> &#8220;Leicester City&#8221; 81 23 &#8220;Arsenal&#8221; 71 20 &#8220;Aston Villa&#8221; 17 3<\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/join.html\" rel=\"noreferrer noopener\"><code>join<\/code><\/a>&nbsp;function can combine tables with a common variable.<\/td><td><\/td><td>EPL = join(EPL,teamInfo)EPL = <strong>Team Points Manager ___________________ ______ ___________________<\/strong> &#8220;Leicester City&#8221; 81 &#8220;Claudio Ranieri&#8221; &#8220;Arsenal&#8221; 71 &#8220;Ars\u00e8ne Wenger&#8221; &#8220;Aston Villa&#8221; 17 &#8220;Eric Black&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Table Properties<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Display the table properties.<\/td><td><\/td><td>EPL.Propertiesans = <strong>Table Properties<\/strong> with properties: Description: &#8221; UserData: [] DimensionNames: {&#8216;Row&#8217; &#8216;Variable&#8217;} VariableNames: {1\u00d711 <strong>cell<\/strong>} VariableDescriptions: {1\u00d711 <strong>cell<\/strong>} VariableUnits: {} VariableContinuity: [] RowNames: {} CustomProperties: No custom properties are set.<\/td><\/tr><tr><td>You can access an individual property of&nbsp;<code>Properties<\/code>&nbsp;using dot notation.<\/td><td><\/td><td>EPL.Properties.VariableNamesans = 1\u00d711 <strong>cell<\/strong> array Columns 1 through 4 {&#8216;Team&#8217;} {&#8216;HomeWins&#8217;} {&#8216;HomeDraws&#8217;} {&#8216;HomeLosses&#8217;} Columns 5 through 8 {&#8216;HomeGF&#8217;} {&#8216;HomeGA&#8217;} {&#8216;AwayWins&#8217;} {&#8216;AwayDraws&#8217;} Columns 9 through 11 {&#8216;AwayLosses&#8217;} {&#8216;AwayGF&#8217;} {&#8216;AwayGA&#8217;}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Indexing into Cell Arrays<\/h2>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/ea134921-b51a-485d-b1d9-fe98c032cc46\" alt=\"determining size\"><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The variable&nbsp;<code>varNames<\/code>&nbsp;is a cell array that contains character arrays of different lengths in each cell.<\/td><td><\/td><td>varNames = teamInfo.Properties.VariableNames<code>'Team'<\/code><code>'Payroll_M__'<\/code><code>'Manager'<\/code><code>'ManagerHireDate'<\/code><\/td><\/tr><tr><td>Using parentheses to index produces a cell array, not the character array inside the cell.<\/td><td><\/td><td>varName(2)<code>'Payroll_M__'<\/code><\/td><\/tr><tr><td>In order to extract the contents inside the cell, you should index using curly braces,&nbsp;<code>{&nbsp;}<\/code>.<\/td><td><\/td><td>varName{2}&#8217;Payroll_M__&#8217;<\/td><\/tr><tr><td>Using curly braces allows you to rename the variable.<\/td><td><\/td><td>varName{2} = &#8216;Payroll&#8217;<code>'Team'<\/code><code>'Payroll'<\/code><code>'Manager'<\/code><code>'ManagerHireDate'<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Working with Dates and Times<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Dates are often automatically detected and brought in as&nbsp;<code>datetime<\/code>&nbsp;arrays.<\/td><td><\/td><td>teamInfoans = <strong>Manager ManagerHireDate _________________ _______________<\/strong> &#8220;Rafael Ben\u00edtez&#8221; 3\/11\/2016 &#8220;Claudio Ranieri&#8221; 7\/13\/2015 &#8220;Ronald Koeman&#8221; 6\/16\/2014 &#8220;David Unsworth&#8221; 5\/12\/2016 &#8220;Slaven Bili\u0107&#8221; 6\/9\/2015<\/td><\/tr><tr><td>Many functions operate on datetime arrays directly, such as&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/sortrows.html\" rel=\"noreferrer noopener\"><code>sortrows<\/code><\/a>.<\/td><td><\/td><td>sortrows(teamInfo,&#8221;ManagerHireDate&#8221;)ans = <strong>Manager ManagerHireDate _________________ _______________<\/strong> &#8220;Ronald Koeman&#8221; 6\/16\/2014 &#8220;Slaven Bili\u0107&#8221; 6\/9\/2015 &#8220;Claudio Ranieri&#8221; 7\/13\/2015 &#8220;Rafael Ben\u00edtez&#8221; 3\/11\/2016 &#8220;David Unsworth&#8221; 5\/12\/2016<\/td><\/tr><tr><td>You can create a&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/datetime.html\" rel=\"noreferrer noopener\"><code>datetime<\/code><\/a>&nbsp;array using numeric inputs. The first input is year, then month, then day.<\/td><td><\/td><td>t = datetime(1977,12,13)t = 13-Dec-1977<\/td><\/tr><tr><td>To create a vector, you can specify an array as input to the&nbsp;<code>datetime<\/code>&nbsp;function.<\/td><td><\/td><td>ts = datetime([1903;1969],[12;7],[17;20])ts = 17-Dec-1903 20-Jul-1969<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Operating on Dates and Times<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Create&nbsp;<code>datetime<\/code>&nbsp;variables to work with.<\/td><td><\/td><td>seasonStart = datetime(2015,8,8)seasonStart = 08-Aug-2015 seasonEnd = datetime(2016,5,17)seasonEnd = 17-May-2016<\/td><\/tr><tr><td>Use subtraction to produce a&nbsp;<code>duration<\/code>&nbsp;variable.<\/td><td><\/td><td>seasonLength = seasonEnd &#8211; seasonStartseasonLength = 6792:00:00<\/td><\/tr><tr><td>Functions such as&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/years.html\" rel=\"noreferrer noopener\"><code>years<\/code><\/a>&nbsp;and&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/days.html\" rel=\"noreferrer noopener\"><code>days<\/code><\/a>&nbsp;can help make better sense of the output.<\/td><td><\/td><td>seasonLength = days(seasonLength)seasonLength = 283<\/td><\/tr><tr><td>They can also create durations from a numeric value.<\/td><td><\/td><td>seconds(5)ans = 5 seconds<\/td><\/tr><tr><td>Use the&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/between.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>between<\/code><\/a>&nbsp;function to produce a context-dependent&nbsp;<code>calendarDuration<\/code>&nbsp;variable.<\/td><td><\/td><td>seasonLength = between(seasonStart,seasonEnd)seasonLength = 9mo 9d<\/td><\/tr><tr><td>Create a calendar duration from a numeric input with functions such as&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/calmonths.html\" rel=\"noreferrer noopener\"><code>calmonths<\/code><\/a>&nbsp;and&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/calendarduration.calyears.html\" rel=\"noreferrer noopener\"><code>calyears<\/code><\/a>.<\/td><td><\/td><td>calmonths(2)ans = 2mo<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can learn more about datetime and duration functions in the documentation.<br><a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/represent-date-and-times-in-MATLAB.html\" rel=\"noreferrer noopener\">Create Date and Time Arrays<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Representing Discrete Categories<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>x<\/code>&nbsp;is a string array.<\/td><td><\/td><td>x = [&#8220;C&#8221; &#8220;B&#8221; &#8220;C&#8221; &#8220;A&#8221; &#8220;B&#8221; &#8220;A&#8221; &#8220;C&#8221;];x = &#8220;C&#8221; &#8220;B&#8221; &#8220;C&#8221; &#8220;A&#8221; &#8220;B&#8221; &#8220;A&#8221; &#8220;C&#8221;<\/td><\/tr><tr><td>You can convert&nbsp;<code>x<\/code>&nbsp;into a categorical array,&nbsp;<code>y<\/code>, using the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/categorical.html\" rel=\"noreferrer noopener\"><code>categorical<\/code><\/a>&nbsp;function.<\/td><td><\/td><td>y = categorical(x);y = C B C A B A C<\/td><\/tr><tr><td>You can use&nbsp;<code>==<\/code>&nbsp;to create a logical array, and count elements using&nbsp;<code>nnz<\/code>.<\/td><td><\/td><td>nnz(x == &#8220;C&#8221;)ans = 3<\/td><\/tr><tr><td>You can view category statistics using the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/summary.html\" rel=\"noreferrer noopener\"><code>summary<\/code><\/a>&nbsp;function.<\/td><td><\/td><td>summary(y) <strong>A B C<\/strong> 2 2 3<\/td><\/tr><tr><td>You can view combine categories using the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/mergecats.html\" rel=\"noreferrer noopener\"><code>mergecats<\/code><\/a>&nbsp;function.<\/td><td><\/td><td>y = mergecats(y,[&#8220;B&#8221; &#8220;C&#8221;],&#8221;D&#8221;)y = D D D A D A D<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">12. Preprocessing Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Preprocessing Data<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Normalizing Data<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Apply statistical function to rows or columns of a matrix. The result is a vector.<br><br><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/c1adc3f1-a43f-4c5d-878f-5e48c0129a5f\"><br><\/li><li>Apply array operation to the matrix and the vector. The vector is &#8220;expanded&#8221; as necessary to make the operation feasible.<br><br><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/fabbbc1b-5fde-4b78-ad08-3f2415d99733\"><br><\/li><\/ol>\n\n\n\n<p><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/normalize.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>normalize<\/code><\/a>Normalize data using a specified normalization method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Working with Missing Data<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Data contains missing values, in the form of both&nbsp;<code>-999<\/code>&nbsp;and&nbsp;<code>NaN<\/code>.<\/td><td><\/td><td>x = [2 NaN 5 3 -999 4 NaN];<\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/ismissing.html\" rel=\"noreferrer noopener\"><code>ismissing<\/code><\/a>&nbsp;function identifies only the&nbsp;<code>NaN<\/code>&nbsp;elements by default.<\/td><td><\/td><td>ismissing(x)ans = 1\u00d77 <strong>logical<\/strong> array 0 1 0 0 0 0 1<\/td><\/tr><tr><td>Specifying the set of missing values ensures that&nbsp;<code>ismissing<\/code>&nbsp;identifies all the missing elements.<\/td><td><\/td><td>ismissing(x,[-999,NaN])ans = 1\u00d77 <strong>logical<\/strong> array 0 1 0 0 1 0 1<\/td><\/tr><tr><td>Use the&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/standardizemissing.html\" rel=\"noreferrer noopener\"><code>standardizeMissing<\/code><\/a>&nbsp;function to convert all missing values to&nbsp;<code>NaN<\/code>.<\/td><td><\/td><td>xNaN = standardizeMissing(x,-999)xNaN = 2 NaN 5 3 NaN 4 NaN<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Ignores&nbsp;<code>NaN<\/code>s by default<br>(default flag is&nbsp;<code>\"omitnan\"<\/code>)<\/th><th>Includes&nbsp;<code>NaN<\/code>s by default<br>(default flag is&nbsp;<code>\"includenan\"<\/code>)<\/th><\/tr><tr><td><code>max<\/code><br><code>min<\/code><\/td><td><code>cov<\/code><br><code>mean<\/code><br><code>median<\/code><br><code>std<\/code><br><code>var<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Data Type<\/th><th>Meaning of &#8220;Missing&#8221;<\/th><\/tr><\/thead><tbody><tr><td><code><strong>double<\/strong><\/code><br><code><strong>single<\/strong><\/code><\/td><td><code>NaN<\/code><\/td><\/tr><tr><td><code>string<\/code>&nbsp;array<\/td><td>Empty string (<code>&lt;missing&gt;<\/code>)<\/td><\/tr><tr><td><code>datetime<\/code><\/td><td><code>NaT<\/code><\/td><\/tr><tr><td><code>duration<\/code><br><code>calendarDuration<\/code><\/td><td><code>NaN<\/code><\/td><\/tr><tr><td><code>categorical<\/code><\/td><td><code>&lt;undefined&gt;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Interpolating Missing Data<\/h2>\n\n\n\n<p><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/fillmissing.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>fillmissing<\/code><\/a>Fills missing values of an array or table.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Interpolation assuming equal spacing of observations.<\/td><td><\/td><td>z = fillmissing(y,&#8221;method&#8221;)<\/td><\/tr><tr><td>Interpolation with given observation locations.<\/td><td><\/td><td>z = fillmissing(y,&#8221;method&#8221;,&#8221;SamplePoints&#8221;,x)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Method<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><code>\"next\"<\/code><\/td><td>The missing value is the same as the next nonmissing value in the data.<\/td><\/tr><tr><td><code>\"previous\"<\/code><\/td><td>The missing value is the same as the previous nonmissing value in the data.<\/td><\/tr><tr><td><code>\"nearest\"<\/code><\/td><td>The missing value is the same as the nearest (next or previous) nonmissing value in the data.<\/td><\/tr><tr><td><code>\"linear\"<\/code><\/td><td>The missing value is the linear interpolation (average) of the previous and next nonmissing values.<\/td><\/tr><tr><td><code>\"spline\"<\/code><\/td><td>Cubic spline interpolation matches the derivatives of the individual interpolants at the data points. This results in an interpolant that is smooth across the whole data set. However, this can also introduce spurious oscillations in the interpolant between data points.<\/td><\/tr><tr><td><code>\"pchip\"<\/code><\/td><td>The cubic Hermite interpolating polynomial method forces the interpolant to maintain the same monotonicity as the data. This prevents oscillation between data points.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">13. Common Data Analysis Techniques<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Common Data Analysis Techniques<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Moving Window Operations<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>movmin<\/code><\/td><td>Moving minimum<\/td><\/tr><tr><td><code>movmax<\/code><\/td><td>Moving maximum<\/td><\/tr><tr><td><code>movsum<\/code><\/td><td>Moving sum<\/td><\/tr><tr><td><code>movmean<\/code><\/td><td>Moving mean<\/td><\/tr><tr><td><code>movmedian<\/code><\/td><td>Moving median<\/td><\/tr><tr><td><code>movstd<\/code><\/td><td>Moving standard deviation<\/td><\/tr><tr><td><code>movvar<\/code><\/td><td>Moving variance<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Mean calculated with a centered moving&nbsp;<em>k<\/em>-point window.<\/td><td><\/td><td>z = movmean(y,k)<\/td><\/tr><tr><td>Mean calculated with a moving window with&nbsp;<em>kb<\/em>&nbsp;points backward and&nbsp;<em>kf<\/em>&nbsp;points forward from the current point.<\/td><td><\/td><td>z = movmean(y,[kb&nbsp;kf])<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Linear Correlation<\/h2>\n\n\n\n<p>You can investigate relationships between variables visually and computationally:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Plot multiple series together. Use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/yyaxis.html\" rel=\"noreferrer noopener\"><code>yyaxis<\/code><\/a>&nbsp;to add another vertical axis to allow for different scales.<\/li><li>Plot variables against each other. Use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/plotmatrix.html\" rel=\"noreferrer noopener\"><code>plotmatrix<\/code><\/a>&nbsp;to create an array of scatter plots.<\/li><li>Calculate linear correlation coefficients. Use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/corrcoef.html\" rel=\"noreferrer noopener\"><code>corrcoef<\/code><\/a>&nbsp;to calculate pairwise correlations.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Plot multiple series together.<\/td><td><\/td><td>yyaxis left plot(&#8230;) yyaxis right plot(&#8230;)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/e98748ae-1163-4722-bcce-feccf32a34e4\"><\/td><\/tr><tr><td>Plot variables against each other.<\/td><td><\/td><td>plotmatrix(data)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/b543c347-e6fb-49fe-8af6-1a2addbcfd04\"><\/td><\/tr><tr><td>Calculate linear correlation coefficients.<\/td><td><\/td><td>corrcoef(data)ans = 1.0000 0.8243 0.1300 0.9519 0.8243 1.0000 0.1590 0.9268 0.1300 0.1590 1.0000 0.2938 0.9519 0.9268 0.2938 1.0000<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Polynomial Fitting<\/h2>\n\n\n\n<p><a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/polyfit.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>polyfit<\/code><\/a>Fits a polynomial to data.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/polyval.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>polyval<\/code><\/a>Evaluates a polynomial at specified locations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Simple fitting<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Fit polynomial to data.<\/td><td><\/td><td>c = polyfit(x,y,n);<\/td><\/tr><tr><td>Evaluate fitted polynomial.<\/td><td><\/td><td>yfit = polyval(c,xfit);<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Fitting with centering and scaling<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Fit polynomial to data.<\/td><td><\/td><td>[c,~,scl] = polyfit(x,y,n);<\/td><\/tr><tr><td>Evaluate fitted polynomial.<\/td><td><\/td><td>yfit = polyval(c,xfit,[],scl);<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">14. Programming Constructs<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Programming Constructs<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">User Interaction<\/h2>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/4fa5601b-3cb2-48b8-8650-f9a3ccd5c9aa\" alt=\"functions for user interactions\"><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>You can use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/inputdlg.html\" rel=\"noreferrer noopener\"><code>inputdlg<\/code><\/a>&nbsp;to gather input from the user.<\/td><td><\/td><td>ctry = inputdlg(&#8220;Enter a country:&#8221;);<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/ccf76846-9a40-463d-ad26-de5a800e3d5f\" alt=\"inputdlg prompt\"><\/td><\/tr><tr><td>You can use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/disp.html\" rel=\"noreferrer noopener\"><code>disp<\/code><\/a>&nbsp;to show output on the command window.<\/td><td><\/td><td>disp(&#8220;Message&#8221;)Message<\/td><\/tr><tr><td>You can use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/warning.html\" rel=\"noreferrer noopener\"><code>warning<\/code><\/a>&nbsp;and&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/error.html\" rel=\"noreferrer noopener\"><code>error<\/code><\/a>&nbsp;as well.<\/td><td><\/td><td>warning(&#8220;Missing data&#8221;)Warning: Missing dataerror(&#8220;Missing data&#8221;)Missing data<\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/msgbox.html\" rel=\"noreferrer noopener\"><code>msgbox<\/code><\/a>,&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/errordlg.html\" rel=\"noreferrer noopener\"><code>errordlg<\/code><\/a>, and&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/warndlg.html\" rel=\"noreferrer noopener\"><code>warndlg<\/code><\/a>&nbsp;functions can display messages to the user.<\/td><td><\/td><td>msgbox(&#8220;Analysis complete&#8221;)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/15955cda-ef20-42af-a8cf-9c21d483e4d7\" alt=\"msgbox\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Decision Branching<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The&nbsp;<code><em>condition_1<\/em><\/code>&nbsp;is evaluated as&nbsp;<code>true<\/code>&nbsp;or&nbsp;<code>false<\/code>.<\/td><td><\/td><td>if <em>condition_1<\/em><\/td><\/tr><tr><td>If&nbsp;<code><em>condition_1<\/em><\/code>&nbsp;is&nbsp;<code>true<\/code>, then the&nbsp;<code><em>code_1<\/em><\/code>&nbsp;code block is executed.<\/td><td><\/td><td><em>code_1<\/em><\/td><\/tr><tr><td>Otherwise, the next case is tested. There can be any number of cases.<\/td><td><\/td><td>elseif <em>condition_2<\/em> <em>code_2<\/em> elseif <em>condition_3<\/em> <em>code_3<\/em><\/td><\/tr><tr><td>If none of the cases are a match, then the code,&nbsp;<code><em>code_e<\/em><\/code>, in&nbsp;<code>else<\/code>&nbsp;is executed.<\/td><td><\/td><td>else <em>code_e<\/em><\/td><\/tr><tr><td>Always end the expression with the keyword&nbsp;<code>end<\/code><\/td><td><\/td><td>end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Evaluate&nbsp;<code>expression<\/code>&nbsp;to return a value.<\/td><td><\/td><td>switch <em>expression<\/em><\/td><\/tr><tr><td>If&nbsp;<code>expression<\/code>&nbsp;equals&nbsp;<code><em>value_1<\/em><\/code>, then&nbsp;<code><em>code_1<\/em><\/code>&nbsp;is executed. Otherwise, the next case is tested. There can be any number of cases.<\/td><td><\/td><td>case <em>value 1<\/em> <em>code_1<\/em> case <em>value 2<\/em> <em>code_2<\/em><\/td><\/tr><tr><td>If none of the cases are a match, then the code,&nbsp;<code><em>code_3<\/em><\/code>, in&nbsp;<code>otherwise<\/code>&nbsp;is executed. The&nbsp;<code>otherwise<\/code>&nbsp;block is optional.<\/td><td><\/td><td>otherwise <em>code_3<\/em><\/td><\/tr><tr><td>Always end the expression with the keyword&nbsp;<code>end<\/code><\/td><td><\/td><td>end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Determining Size<\/h2>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/ebd16b50-bf6c-4795-a893-15e55e100068\" alt=\"determining size\"><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/size.html\" rel=\"noreferrer noopener\"><code>size<\/code><\/a>&nbsp;to find the dimensions of a matrix.<\/td><td><\/td><td>s = size(prices)s = 19 10 [m,n] = size(prices)m = 19 n = 10 m = size(prices,1)m = 19 n = size(prices,2)n = 10<\/td><\/tr><tr><td>Use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/length.html\" rel=\"noreferrer noopener\"><code>length<\/code><\/a>&nbsp;when working with vectors where one of the dimensions returned by&nbsp;<code>size<\/code>&nbsp;is&nbsp;<code>1<\/code>.<\/td><td><\/td><td>m = length(Year)m = 19<\/td><\/tr><tr><td>Use&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/double.numel.html\" rel=\"noreferrer noopener\"><code>numel<\/code><\/a>&nbsp;to find the total number of elements in an array of any dimension.<\/td><td><\/td><td>N = numel(prices)N = 190<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">For Loops<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The index is defined as a vector. Note the use of the colon syntax to define the values that the index will take.<\/td><td><\/td><td>for <em>index<\/em> = <em>first:increment:last<\/em> <em>code<\/em> end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">While Loops<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The condition is a variable or expression that evaluates to&nbsp;<code>true<\/code>&nbsp;or&nbsp;<code>false<\/code>. While&nbsp;<code><em>condition<\/em><\/code>&nbsp;is&nbsp;<code>true<\/code>,&nbsp;<code>code<\/code>&nbsp;executes. Once&nbsp;<code><em>condition<\/em><\/code>&nbsp;becomes false, the loop ceases execution.<\/td><td><\/td><td>while <em>condition<\/em> <em>code<\/em> end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">15. Increasing Automation with Functions<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Increasing Automation with Functions<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Creating and Calling Functions<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Define a function<\/th><th>Call a function<\/th><\/tr><\/thead><tbody><tr><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/2ee603bc-5913-4f0b-add3-3fa758b136e8\" alt=\"x and y\"><\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/0078f4b9-d0f9-4f56-a392-e10dfd9da76b\" alt=\"x and y\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Function Files<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function Type<\/th><th>Function Visibility<\/th><\/tr><\/thead><tbody><tr><td><strong>Local functions:<\/strong><br>Functions that are defined within a script.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td>Visible only within the file where they are defined.<\/td><\/tr><tr><td><strong>Functions:<\/strong><br>Functions that are defined in separate files.<\/td><td>Visible to other script and function files.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Workspaces<\/h2>\n\n\n\n<p>A function maintains its own workspace to store variables created in the function body.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>a = 42; b = foo(a);<\/td><td><br><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/4a826eea-6bb9-49bc-9b07-d8fce212901a\" alt=\"transfer\"><\/td><td>foo.mlxfunction&nbsp;y&nbsp;=&nbsp;foo(x)&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;=&nbsp;sin(x);&nbsp;&nbsp;&nbsp;&nbsp;x&nbsp;=&nbsp;x&nbsp;+&nbsp;1;&nbsp;&nbsp;&nbsp;&nbsp;b&nbsp;=&nbsp;sin(x);&nbsp;&nbsp;&nbsp;&nbsp;y&nbsp;=&nbsp;a*b;end<\/td><\/tr><tr><td><br>Base Workspace<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/a1135d66-535a-49e8-86e1-1ab92c4bcaf0\">&nbsp;&nbsp; a&nbsp;&nbsp;42<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/988cc46b-496c-4596-973a-896e33060353\">&nbsp;&nbsp;b&nbsp;&nbsp;0.7623<\/td><td>&nbsp;<\/td><td><br>Function Workspace<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/0e83738e-d89c-41e5-b8d6-4ef1268ca24c\">&nbsp;&nbsp;a&nbsp;&nbsp;-0.9165<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/caf3dc30-ed03-4216-99a9-6fe624dcd290\">&nbsp;&nbsp;b&nbsp;&nbsp;-0.8318<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/01d735f8-9eb1-4969-8c2e-7f506ebb4a3b\">&nbsp;&nbsp;x&nbsp;&nbsp;43<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/502deb1d-3ae5-4f58-975b-bf9b1e31c733\">&nbsp;&nbsp;y&nbsp;&nbsp;0.7623<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">MATLAB Path and Calling Precedence<\/h2>\n\n\n\n<p>In MATLAB, there are rules for interpreting any named item. These rules are referred to as the function precedence order. Most of the common reference conflicts can be resolved using the following order:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Variables<\/li><li>Functions defined in the current script<\/li><li>Files in the current folder<\/li><li>Files on MATLAB search path<\/li><\/ol>\n\n\n\n<p>A more comprehensive list can be found&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/function-precedence-order.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p>The search path, or&nbsp;<em>path<\/em>&nbsp;is a subset of all the folders in the file system. MATLAB can access all files in the folders on the search path.<br>To add folders to the search path:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>On the&nbsp;<strong>Home<\/strong>&nbsp;tab, in the&nbsp;<strong>Environment<\/strong>&nbsp;section, click&nbsp;<strong>Set Path<\/strong>.<\/li><li>Add a single folder or a set of folders using the buttons highlighted below.<\/li><\/ol>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/9f43924d-4522-4693-ac03-6d7f2c698190\" alt=\"search path screenshot\"><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">16. Troubleshooting Code<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Troubleshooting Code<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Code Analyzer<\/h2>\n\n\n\n<p>Use the MATLAB Code Analyzer messages shown in the Editor to identify and fix syntax errors.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Icon<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/885d4c5a-4701-449d-b88e-22ca8aa2491e\"><\/td><td>There is a potential for unexpected results or poor code performance.<\/td><\/tr><tr><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/c4233a59-cc2d-437a-9c87-6949c4f26011\"><\/td><td>There are syntax errors that must be addressed.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Debugging Run-Time Errors<\/h2>\n\n\n\n<p>When debugging MATLAB code, a common workflow is as follows.<canvas width=\"720\" height=\"420\"><\/canvas>Note that after you&#8217;ve identified and fixed any bugs, you should stop your debugging session, save your changes, and clear all breakpoints before running your code again.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">17. Review Project II<\/h1>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">18. Conclusion<\/h1>\n\n\n\n<!--nextpage-->\n\n\n\n<h1 class=\"wp-block-heading\">MATLAB for Data Processing and Visualization<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">1. Getting Started<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Getting Started with the Data<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/readtable.html\" rel=\"noreferrer noopener\"><code>readtable<\/code><\/a>&nbsp;function creates a table in MATLAB from a data file.<br><br>Additional inputs can help import irregularly formatted files.<\/td><td><\/td><td>hurrs = readtable(&#8220;hurricaneData1990s.txt&#8221;,&#8230; &#8220;NumHeaderLines&#8221;,5,&#8221;CommentStyle&#8221;,&#8221;##&#8221;);<\/td><\/tr><tr><td>You can use dot notation to access variables in a table. The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/scatter.html\" rel=\"noreferrer noopener\"><code>scatter<\/code><\/a>&nbsp;function creates a scatter plot of two vectors.<\/td><td><\/td><td>scatter(hurrs.Windspeed,hurrs.Pressure)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/2f412a0d-6239-47fd-8123-27a2fb713f7e\"><\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/categorical.html\" rel=\"noreferrer noopener\"><code>categorical<\/code><\/a>&nbsp;function creates a categorical array from data.<\/td><td><\/td><td>hurrs.Country = categorical(hurrs.Country);<\/td><\/tr><tr><td>By default, the&nbsp;<code>readtable<\/code>&nbsp;function may import certain variables in the table as&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/datetime.html\" rel=\"noreferrer noopener\"><code>datetime<\/code><\/a>.<br><br>In this example,&nbsp;<code>hurrs.Timestamp<\/code>&nbsp;is a&nbsp;<code>datetime<\/code>.<\/td><td><\/td><td>t = hurrs.Timestamp;<\/td><\/tr><tr><td>The&nbsp;<a target=\"_blank\" href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/datetime.hour.html\" rel=\"noreferrer noopener\"><code>hour<\/code><\/a>&nbsp;function returns the hour numbers of the input datetime values.<\/td><td><\/td><td>h = hour(t); histogram(h)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/b8a06693-dc8a-48c5-a340-d02594e4aa62\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2. Preprocessing Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Preprocessing Data<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Missing Data<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>When you import data into MATLAB, missing numerical values are replaced with NaN, which stands for&nbsp;<strong>N<\/strong>ot&nbsp;<strong>a<\/strong>&nbsp;<strong>N<\/strong>umber.<\/td><td><\/td><td>data = readtable(&#8220;myfile&#8221;)data = 4\u00d72 table Var1 Var2 ____ ____ 7 0.81 1 NaN 9 0.13 10 0.91<\/td><\/tr><tr><td>When you calculate statistics on arrays that contain NaNs, the result in another NaN.<\/td><td><\/td><td>v = mean(data.Var2)v = NaN<\/td><\/tr><tr><td>To ignore NaNs in the calculation, use the&nbsp;<code>\"omitnan\"<\/code>&nbsp;flag.<\/td><td><\/td><td>v = mean(data.Var2,&#8221;omitnan&#8221;)v = 0.6167<\/td><\/tr><tr><td>You can delete rows containing missing data with&nbsp;<code>rmmissing<\/code>.<\/td><td><\/td><td>cleaned = rmmissing(data)cleaned = 3\u00d72 table Var1 Var2 ____ ____ 7 0.81 9 0.13 10 0.91<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Categories and Sets<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Categorical arrays use less less memory and work with many plotting functions.<\/td><td><\/td><td>x = categorical([&#8220;medium&#8221; &#8220;large&#8221; &#8220;large&#8221; &#8220;red&#8221; &#8220;small&#8221; &#8220;red&#8221;]);<\/td><\/tr><tr><td>Use the&nbsp;<code>categories<\/code>&nbsp;function to get a list of unique categories.<\/td><td><\/td><td>c = categories(x)c = 4\u00d71 <strong>cell<\/strong> array {&#8216;large&#8217; } {&#8216;medium&#8217;} {&#8216;red&#8217; } {&#8216;small&#8217; }<\/td><\/tr><tr><td>Merge different categories with the&nbsp;<code>mergecats<\/code>&nbsp;function.<\/td><td><\/td><td>x = mergecats(x,[&#8220;small&#8221; &#8220;medium&#8221; &#8220;large&#8221;],&#8221;size&#8221;)x = 1\u00d76 categorical array size size size red size red<\/td><\/tr><tr><td>Rename categories with the&nbsp;<code>renamecats<\/code>&nbsp;function.<\/td><td><\/td><td>x = renamecats(x,&#8221;red&#8221;,&#8221;color&#8221;)x = 1\u00d76 categorical array size size size color size color<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Discretizing Continuous Data<\/h2>\n\n\n\n<p>Ranges in continuous data can represent categories. Categorize continues data into discrete bins with the&nbsp;<code>discretize<\/code>&nbsp;function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; y = discretize(X,edges,\"Categorical\",cats)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>y<\/code><\/td><td>If the&nbsp;<code>\"Categorical\"<\/code>&nbsp;option is set,&nbsp;<code>y<\/code>&nbsp;is a categorical array. Otherwise,&nbsp;<code>y<\/code>&nbsp;is numeric bin values.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>X<\/code><\/td><td>Array of continuous data.&nbsp;<code>X<\/code>&nbsp;is usually numeric or datetime.<\/td><\/tr><tr><td><code>edges<\/code><\/td><td>Consecutive elements in&nbsp;<code>edges<\/code>&nbsp;form discrete bins. There will be one fewer bins than the number of edges specified.<br><br>You can use&nbsp;<code>inf<\/code>&nbsp;in&nbsp;<code>edges<\/code>&nbsp;to create a bin with no edge.<\/td><\/tr><tr><td><code>\"Categorical\",cats<\/code><\/td><td>Optional input for the name of each bin category.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">3. Graphics Formatting Functions<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Graphics Formatting Functions<\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">plot(x,y)\n\n\n\n<\/pre>\n\n\n\n<p><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/b67c2aee-7ff3-4cdc-9c1e-ba5d9d1032d8\"><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-5-1.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6368\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-4.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6367\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<p>As a reminder, here is a plot with default properties. There are no markers and the line color is blue.<code><\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><li><\/li><li><\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.graphics.chart.primitive.line-properties.html\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><code><\/code><code><\/code><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><\/th><th><\/th><\/tr><\/thead><tbody><tr><td><code><\/code><\/td><td><\/td><\/tr><tr><td><code><\/code><\/td><td><\/td><\/tr><tr><td><code><\/code><\/td><td><\/td><\/tr><tr><td><code><\/code><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">4. Review Project 1<\/h1>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">5. Importing Data from Multiple Files<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Importing Data from Multiple Files<\/h1>\n\n\n\n<p>A datastore is a reference to a file or set of files. The&nbsp;<code>datastore<\/code>&nbsp;function informs where to find the files.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Code<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>ds = datastore(<em>filename<\/em>)<\/td><td>Reference a single file<\/td><\/tr><tr><td>ds = datastore(<em>directory<\/em>)<\/td><td>Reference a folder of files<\/td><\/tr><tr><td>data = read(ds)<\/td><td>Read data incrementally<\/td><\/tr><tr><td>data = readall(ds)<\/td><td>Read all data referenced in datastore<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If your data isn&#8217;t formatted the way&nbsp;<code>datastore<\/code>&nbsp;expects, you can set the datastore properties. Examples of common properties are shown below. You can find all the properties in the&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/datastore.html#namevaluepairs\" target=\"_blank\" rel=\"noreferrer noopener\">the documentation<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; ds = datastore(filename,\"Delimiter\",\"-\",\"TextscanFormats\",\"%D%C%f\",\"SelectedVariableNames\",var)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>ds<\/code><\/td><td>Reference to a collection of data.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>filename<\/code><\/td><td>File location.<\/td><\/tr><tr><td><code>\"Delimiter\",\"-\"<\/code><\/td><td>Delimiter is one or more characters that separate data values in the file.<\/td><\/tr><tr><td><code>\"TextscanFormats\",\"%D%C%f\"<\/code><\/td><td>Import variables using the output class in the&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/textscan.html#btghhyz-1-formatSpec\" target=\"_blank\" rel=\"noreferrer noopener\">format specification string<\/a>.<\/td><\/tr><tr><td><code>\"SelectedVariableNames\",var<\/code><\/td><td>Import only the variables listed in&nbsp;<code>var<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Merging Data<\/h2>\n\n\n\n<p>Once you read in multiple tables, you may want to join them together. You can join two tables in many ways. The various&nbsp;<code>join<\/code>&nbsp;functions are listed in the table below.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td>join<br><br><code>Key1<\/code>&nbsp;in&nbsp;<code>Tright<\/code>&nbsp;must have unique values and contain every key in&nbsp;<code>Tleft<\/code>.<\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/a24f5f6d-bece-438a-b528-c8f4f8173d83\"><\/td><\/tr><tr><td>innerjoin<\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/9fc112cd-8111-4671-b6b5-3d03da5bb9d3\"><\/td><\/tr><tr><td>outerjoin<br><br>Two key variables are created.<\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/36d0043a-df0b-40dd-9551-47e1de80f8ba\"><\/td><\/tr><tr><td>outerjoin&nbsp;with&nbsp;<code>\"MergeKeys\"<\/code>&nbsp;on<\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/9a287a09-1fef-478d-a453-2c7c3360fe86\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">6. Analyzing Groups within Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Analyzing Groups within Data<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The table&nbsp;<code>petdata<\/code>&nbsp;has two categorical variables,&nbsp;<code>Species<\/code>&nbsp;and&nbsp;<code>Color<\/code>.<br><br>Using these two variables, there are five potential groups:Orange catOrange fishBlack catBlack fishWhite cat<\/td><td><\/td><td>petdata = readtable(&#8220;petdata.txt&#8221;,&#8221;Format&#8221;,&#8221;%C%C%f&#8221;) 5\u00d73 table Species Color Weight _______ ______ ______ cat orange 12 fish orange 0.68 cat black 14 cat white 8 fish black 0.54<\/td><\/tr><tr><td>The&nbsp;<code>findgroups<\/code>&nbsp;function will return a group number for each element in an array.<br><br>The second output is the name associated with each group number. Here, the value&nbsp;<code>1<\/code>&nbsp;means&nbsp;<code>cat<\/code>.<\/td><td><\/td><td>[grpS,speciesVals] = findgroups(petdata.Species)grpS = 1 2 1 1 2 speciesVals = 2\u00d71 categorical array cat fish<\/td><\/tr><tr><td>The&nbsp;<code>splitapply<\/code>&nbsp;function will peform a calculation on each inputted group.<br><br>You can interpret this code as &#8220;What is the average weight of each species?&#8221;<\/td><td><\/td><td>splitapply(@mean,Weight,grpS)ans = 11.3333 0.6100<\/td><\/tr><tr><td><code>findgroups<\/code>&nbsp;and&nbsp;<code>splitapply<\/code>&nbsp;are commonly used together. This code answers &#8220;What is the minimum weight of each color?&#8221;<br><br>Notice that&nbsp;<code>grpC<\/code>&nbsp;has values 1, 2, and 3 because there are three different colors in the data.&nbsp;<code>colorVals<\/code>&nbsp;contains the meaning for each value.<\/td><td><\/td><td>[grpC,colorVals] = findgroups(petdata.Color) splitapply(@min,Weight,grpC)grpC = 2 2 1 3 1 colorVals = 3\u00d71 categorical array black orange white ans = 0.5400 0.6800 8.0000<\/td><\/tr><tr><td><code>accumarray<\/code>&nbsp;calculates a value for all five potential groups.<br><br>The first input is an array containing both group numbers. The first vector (<code>grpS<\/code>) corresponds to the output rows, and the second vector (<code>grpC<\/code>) corresponds to the output colulmns.<br><br>Notice that the element in the second column, third row (white fish) is 0 because there&#8217;s no data in that group.<br><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/1c71734a-7f56-4d66-b483-f582c8d8237e\"><\/td><td><\/td><td>maxWeight = accumarray([grpS grpC],Weight,[],@max)maxWeight = 14.0000 12.0000 8.0000 0.5400 0.6800 0<\/td><\/tr><tr><td>The output of&nbsp;<code>accumarray<\/code>&nbsp;can be difficult to interpret on its own, but the format is convenient for visualizations or further processing.<br><br>For example, the output can be passed directly to the&nbsp;<code>bar<\/code>&nbsp;function.<\/td><td><\/td><td>bar(maxWeight) xticklabels(speciesVals) ylabel(&#8220;Weight&#8221;) legend(colorVals)<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/a7f41d5b-cd66-47a7-a9ed-c6c1bdb7676b\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">7. Customizing Graphics Objects<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Customizing Graphics Objects<\/h1>\n\n\n\n<p>All graphics objects are part of a hierarchy. Most graphics objects consist of a figure window, containing one or more axes, which contain any number of plot objects.<\/p>\n\n\n\n<p>You can use the graphics object hierarchy to modify specific graphics objects after a plot is created.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-7.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6366\"\/><\/figure>\n\n\n\n<p>If you stored a handle to&nbsp;<code>Figure<\/code>, you could use the&nbsp;<code>Children<\/code>&nbsp;properties to modify the&nbsp;<code>Bar<\/code>&nbsp;plot.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">8. Review Project 2<\/h1>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">9. Images and 3-D Surface Plots<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Images and 3-D Surface Plots<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Images or 3-D plots generally begin with x, y, and z data. In many cases, the x and y data are not evenly spaced on a grid.<\/td><td><\/td><td>data = readtable(&#8220;my3Ddata&#8221;) plot3(data.x,data.y,data.z,&#8217;.&#8217;) x y z _________ ________ ___________ 2.2506 -0.30105 0.012974 -1.3443 -0.79976 -0.11638 0.53421 -0.92891 0.16945 -0.070088 -0.67461 -0.044245 &#8230; &#8230; &#8230; <img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/752d648d-300c-4bae-b821-b8b747d99134\"><\/td><\/tr><tr><td>To interpolate the data onto a grid, start by defining the grid points. Here,&nbsp;<code>yvec<\/code>&nbsp;is denser than&nbsp;<code>xvec<\/code>.<\/td><td><\/td><td>xvec = -2:.2:2; yvec = -2:.05:2;<\/td><\/tr><tr><td>The&nbsp;<code>meshgrid<\/code>&nbsp;function will convert your vectors into the grid expected by&nbsp;<code>surf<\/code>&nbsp;and&nbsp;<code>pcolor<\/code>.<\/td><td><\/td><td>[xgrid,ygrid] = meshgrid(xvec,yvec);<\/td><\/tr><tr><td>Then use the&nbsp;<code>griddata<\/code>&nbsp;function to interpolate your data onto the grid.<br><br>Consistent naming of your variables from previous steps will the&nbsp;<code>griddata<\/code>&nbsp;syntax easier.<\/td><td><\/td><td>zgrid = griddata(data.x,data.y,data.z,xgrid,ygrid);<\/td><\/tr><tr><td>Once your x, y, and z data is gridded, you can visualize it in a variety of ways.&nbsp;<code>surf<\/code>&nbsp;creates a surface plot.<br><br>Notice the difference between the&nbsp;<code>x<\/code>&nbsp;and&nbsp;<code>y<\/code>&nbsp;axes. This is because&nbsp;<code>xvec<\/code>&nbsp;and&nbsp;<code>yvec<\/code>&nbsp;had a different number of grid points.<\/td><td><\/td><td>surf(xgrid,ygrid,zgrid);<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/7254467a-9481-4d54-9a28-b0cc1b1c68cc\"><\/td><\/tr><tr><td>You can also visualize your 3-D data as an pseudocolor image.<\/td><td><\/td><td>im = pcolor(xgrid,ygrid,zgrid); im.EdgeAlpha = 0;<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/f896b887-3265-4d49-8c3a-00da9012089b\"><\/td><\/tr><tr><td>This scaled image contains the same data, but the first two inputs are the vectors of grid points instead of the output from&nbsp;<code>meshgrid<\/code>.<br><br>If you inspect the right yellow shape, you can see that the&nbsp;<code>imagesc<\/code>&nbsp;plot is vertically flipped from the&nbsp;<code>pcolor<\/code>&nbsp;plot.<\/td><td><\/td><td>imagesc(xvec,yvec,zgrid);<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/85fdd054-249b-42de-b5a5-99021e374561\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">10. Importing Unstructured Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Review &#8211; Importing Unstructured Data<\/h1>\n\n\n\n<p>To import data from files where the formatting changes and must be inferred from the data itself, you can use functions that allow you to interact directly with files.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Open the file and store the file identifier. You&#8217;ll use&nbsp;<code>fid<\/code>&nbsp;with the other low-level import functions.<\/td><td><\/td><td>fid = fopen(&#8220;myfile&#8221;);<\/td><\/tr><tr><td>You can import files line-by-line using&nbsp;<code>fgetl<\/code>.<br><br>There is a file position indicator that keeps track of where you&#8217;re located in the file, so calling&nbsp;<code>fgetl<\/code>&nbsp;twice will return the first two lines.<\/td><td><\/td><td>firstLine = fgetl(fid)firstLine = &#8217;09\/12\/2005 Level1 12.34 45 1.23e10 inf&#8217;secondLine = fgetl(fid)secondLine = &#8217;10\/12\/2005 Level2 23.54 60 9e19 -inf 0.001&#8242;<\/td><\/tr><tr><td>To return back to the beginning of the file, you can rewind the file position indicator.<\/td><td><\/td><td>frewind(fid)<\/td><\/tr><tr><td>If you know the format of the data, you can pass a&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/textscan.html#btghhyz-1-formatSpec\" target=\"_blank\" rel=\"noreferrer noopener\">format specification string<\/a>&nbsp;to&nbsp;<code>textscan<\/code>.<\/td><td><\/td><td>formatSpec = &#8220;%{MM\/dd\/uuuu}D %s %f32 %d8 %u %f&#8221;; myData = textscan(fid, formatSpec)myData = 1\u00d79 <strong>cell<\/strong> array {3\u00d71 datetime} {3\u00d71 <strong>cell<\/strong>} {3\u00d71 <strong>single<\/strong>} {3\u00d71 <strong>int8<\/strong>} {3\u00d71 <strong>uint32<\/strong>} {3\u00d71 <strong>double<\/strong>}<\/td><\/tr><tr><td>When you&#8217;re finished importing, make sure you close the file connection.<\/td><td><\/td><td>fclose(fid);<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">11. Conclusion<\/h1>\n\n\n\n<!--nextpage-->\n\n\n\n<h1 class=\"wp-block-heading\">MATLAB Programming Techniques<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">1. Introduction<\/h1>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2. Structuring Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary: Overview of MATLAB Data Types<\/h1>\n\n\n\n<p>Each array type is intended to store data with a characteristic organization. Some arrays hold data all of the same data type, and others allow storage of different data types.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-13.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6381\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Homogeneous Arrays<\/h2>\n\n\n\n<p>Homogeneous arrays are scalars, vectors, matrices, and higher dimensional arrays whose elements all have the same data type. Elements of an array can be numbers, logical values, dates and times, strings, or one of many other other data types. For instance, a logical matrix would be a rectangular array with elements that are all logical values.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Array Type<\/th><th>Intended Contents<\/th><\/tr><\/thead><tbody><tr><td><strong>single<\/strong><br><strong>double<\/strong><\/td><td>Floating-point numbers with ~8 (<code><strong>single<\/strong><\/code>) or ~16 (<code><strong>double<\/strong><\/code>) decimal places of precision<br><br>Unless otherwise specified MATLAB stores all numeric variables as type&nbsp;<code><strong>double<\/strong><\/code>.<\/td><\/tr><tr><td>int*<br>uint*<\/td><td>Integer values of various ranges<\/td><\/tr><tr><td><strong>char<\/strong><br>string<\/td><td>Text<\/td><\/tr><tr><td>datetime<br>duration<br>calendarDuration<\/td><td>Dates, times, durations between dates and times<\/td><\/tr><tr><td><strong>logical<\/strong><\/td><td>Boolean (true\/false) values<\/td><\/tr><tr><td>categorical<\/td><td>Values from a finite set of alphanumeric (usually text) labels<\/td><\/tr><tr><td>function_handle<\/td><td>The definition of a function<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Heterogeneous Arrays<\/h2>\n\n\n\n<p>Sometimes data are not all the same data type or size. There are specific containers for these heterogeneous data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-14.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6378\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary &#8211; Structuring Data<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Character Arrays vs String Arrays<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-6.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6376\"\/><\/figure>\n\n\n\n<p>The primary difference between a character array and a string array is that an individual element of a character array is a character and an element of a string array is a piece of text, which consists of&nbsp;<em>several characters.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing Data in Tables<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>When several variables in your workspace hold data about the same observations, you can use the table function to collect this information into a table.<\/td><td><\/td><td>t1 = table(var1,var2, &#8216;VariableNames&#8217;,{&#8216;Thought1&#8242;,&#8217;OnSecondThought&#8217;})t1 = 2&#215;2 table Thought1 OnSecondThought ________ _______________ &#8220;Ford&#8221; 32.7 &#8220;Toyota&#8221; 1<\/td><\/tr><tr><td>You can index into a table using array indexing with parentheses. Columns can be specified either numerically or by name.<\/td><td><\/td><td>t2 = t1(2,&#8221;Thought1&#8243;);t2 = table Thought1 ________ &#8220;Toyota&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing Data in Cell Arrays<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Create a cell array using curly braces and separating elements with commas and semicolons.<\/td><td><\/td><td>car = {&#8216;Ford&#8217;,&#8217;Expedition&#8217;;32.7,true}car = 2\u00d72 <strong>cell<\/strong> array {&#8216;Ford&#8217; } {&#8216;Expedition&#8217;} {[32.7000]} {[ 1]}<\/td><\/tr><tr><td>You can index into a cell array using standard MATLAB indexing with parentheses, (). This returns a portion of the original cell array.<\/td><td><\/td><td>car(1,1) ans = 1&#215;1 <strong>cell<\/strong> array {&#8216;Ford&#8217;}<\/td><\/tr><tr><td>You can access the contents of cells in a cell array by indexing with curly braces, {}, rather than parentheses, ().<\/td><td><\/td><td>car{1,1} ans = &#8216;Ford&#8217;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing Data in Structures<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>This syntax creates a structure named&nbsp;<code>car<\/code>&nbsp;with a field named&nbsp;<code>make<\/code>&nbsp;and assigns a value to that field.<\/td><td><\/td><td>car.make = &#8220;Ford&#8221;car = <em>struct with fields:<\/em> make: &#8220;Ford&#8221;<\/td><\/tr><tr><td>The same dot notation can be used to create new fields.<\/td><td><\/td><td>car.model = &#8220;Expedition&#8221;car = <em>struct with fields:<\/em> make: &#8220;Ford&#8221; model: &#8220;Expedition&#8221;<\/td><\/tr><tr><td>To add an element to a structure array, use parentheses and assign a value to a field of the struct.<\/td><td><\/td><td>car(2).model = &#8220;Prius&#8221;car = 1-by-2 struct makemodel&#8221;Ford&#8221;&#8221;Expedition&#8221;[]&#8221;Prius&#8221;<\/td><\/tr><tr><td>You can use the field name and array indexing to extract the data.<\/td><td><\/td><td>car(2).modelans = &#8220;Prius&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">3. Manipulating Heterogeneous Data<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">How Do You Collect Output from Comma-separated Lists?<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Concatenating Horizontally<\/h2>\n\n\n\n<p>Regardless of where the comma-separated list comes from, square brackets concatenate the data into a row vector.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cell Arrays<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The 2-by-2 cell array stored in the&nbsp;<code>x<\/code>&nbsp;variable contains four scalars.<\/td><td><\/td><td>xx = [10] [20] [30] [40]<\/td><\/tr><tr><td>Using square brackets creates a numeric row vector. The elements of&nbsp;<code>x<\/code>&nbsp;are concatenated columnwise.<\/td><td><\/td><td>[x{:}]ans = 10 30 20 40<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Structure Arrays<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The structure array stored in the&nbsp;<code>data<\/code>&nbsp;variable has four elements.&nbsp;<code>data.coords<\/code>&nbsp;returns the&nbsp;<code>coords<\/code>&nbsp;field of each element separately.<\/td><td><\/td><td>data.coordsans = 0.2081 0.1663 0.5292 ans = 0.0265 0.6137 0.8135 ans = 0.6473 0.7456 0.4188 ans = 0.9763 0.9831 0.0538<\/td><\/tr><tr><td>Concatenating with square brackets concatenates columnwise, which creates a single 1-by-12 vector from the four 1-by-3 vectors.<\/td><td><\/td><td>y = [data.coords]y = Columns 1 through 4 0.2081 0.1663 0.5292 0.0265 Columns 5 through 8 0.6137 0.8135 0.6473 0.7456 Columns 9 through 12 0.4188 0.9763 0.9831 0.0538<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concatenating Vertically<\/h2>\n\n\n\n<p>You can use the&nbsp;<code>vertcat<\/code>&nbsp;function on comma-separated lists to concatenate vertically.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cell Arrays<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The 2-by-2 cell array stored in the&nbsp;<code>x<\/code>&nbsp;variable contains four scalars.<\/td><td><\/td><td>xx = [10] [20] [30] [40]<\/td><\/tr><tr><td>Extract multiple outputs from&nbsp;<code>x<\/code>&nbsp;and concatenate vertically.<\/td><td><\/td><td>vertcat(x{:})ans = 10 30 20 40<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Structure Arrays<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The structure array stored in the&nbsp;<code>data<\/code>&nbsp;variable has four elements.<\/td><td><\/td><td>data.coordsans = 0.2081 0.1663 0.5292 ans = 0.0265 0.6137 0.8135 ans = 0.6473 0.7456 0.4188 ans = 0.9763 0.9831 0.0538<\/td><\/tr><tr><td>Stack the data vertically<\/td><td><\/td><td>x = vertcat(data.coords)x = 0.2081 0.1663 0.5292 0.0265 0.6137 0.8135 0.6473 0.7456 0.4188 0.9763 0.9831 0.0538<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Concatenating into a Cell Array<\/h2>\n\n\n\n<p>If your comma-separated list contains data that cannot be combined into a homogeneous array, then you can combine it into a cell array using curly braces.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>y<\/code>&nbsp;is a 3-element structure with fields&nbsp;<code>name&nbsp;<\/code>and&nbsp;<code>price<\/code><\/td><td><\/td><td>yy = 1&#215;3 <strong>struct<\/strong> array with fields: name price<\/td><\/tr><tr><td>The&nbsp;<code>name<\/code>&nbsp;fields contains the name of fruits.<\/td><td><\/td><td>y.nameans = &#8216;Banana&#8217; ans = &#8216;Apple&#8217; ans = &#8216;Orange&#8217;<\/td><\/tr><tr><td>Those names can be put into cells and concatenated into a cell array using curly braces.<\/td><td><\/td><td>{y.name}ans = {&#8216;Banana&#8217;} {&#8216;Apple&#8217;} {&#8216;Orange&#8217;}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">How Do You Create and Use a Function Handle?<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Create a Function Handle to a Defined Function<\/h2>\n\n\n\n<p>Use the @ symbol to create a function handle referencing an existing function. You can reference a MATLAB function, a local function, or a function defined in a function file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-5-2.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6374\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Create a Function Handle to a Specific Command<\/h2>\n\n\n\n<p>These are called&nbsp;<em>anonymous functions<\/em>. Again, you use the @ symbol. Specify inputs with parentheses.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-10.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6375\"\/><\/figure>\n\n\n\n<p>Here, the function handle&nbsp;<code>g<\/code>&nbsp;has three inputs:&nbsp;<code>a<\/code>,&nbsp;<code>b<\/code>, and&nbsp;<code>c&nbsp;<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Function Handles<\/h2>\n\n\n\n<p>Once defined, the function handles&nbsp;<code>f<\/code>&nbsp;and&nbsp;<code>g<\/code>&nbsp;can be used the same way. They can be called with inputs or passed as an input to another function.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Construct a function handle with an&nbsp;<code>@<\/code>&nbsp;sign.<\/td><td><\/td><td>h = @sin;<\/td><\/tr><tr><td>Call the function handle in the same way that you would call the function directly.<\/td><td><\/td><td>h(0)ans = 0h(pi\/2)ans = 1<\/td><\/tr><tr><td>Some functions, such as&nbsp;<code>integral<\/code>, require an input function. In this case, pass a function handle as an input.<\/td><td><\/td><td>integral(h,0,pi)ans = 2.0000integral(@log,1,2)ans = 0.3863<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">How Do You Apply Functions to Arrays?<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Apply a Function to Each Element of an Array<\/h2>\n\n\n\n<p>You can apply a function to each element of an array with&nbsp;<code>arrayfun<\/code>. The&nbsp;<code>arrayfun&nbsp;<\/code>function works on any array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; B = arrayfun(func,A)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>B<\/code><\/td><td>An array whose elements are the output of&nbsp;<code>func<\/code>&nbsp;operating on each element of&nbsp;<code>A<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>func<\/code><\/td><td>A function handle<\/td><\/tr><tr><td><code>A<\/code><\/td><td>An array<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If&nbsp;<code>func<\/code>&nbsp;returns scalars of the same data type, then&nbsp;<code>B<\/code>&nbsp;is an array of that data type. If the outputs of&nbsp;<code>func<\/code>&nbsp;are non-scalar or non-uniform, set the&nbsp;<code>\"UniformOutput\"<\/code>&nbsp;property to&nbsp;<code>false<\/code>. In this case,&nbsp;<code>B<\/code>&nbsp;is a cell array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  B = arrayfun(func,A,\"UniformOutput\",false)\n    <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Applying a Function to the Contents of a Cell Array<\/h2>\n\n\n\n<p>You can apply a function to the contents of each element of a cell array with&nbsp;<code>cellfun<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; B = cellfun(func,C)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>B<\/code><\/td><td>An array whose elements are the output of&nbsp;<code>func<\/code>&nbsp;operating on each element of&nbsp;<code>C<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>func<\/code><\/td><td>A function handle<\/td><\/tr><tr><td><code>C<\/code><\/td><td>A cell array<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Use the&nbsp;<code>\"UniformOutput\"<\/code>&nbsp;property to specify that the output of&nbsp;<code>func<\/code>&nbsp;is either not a scalar or non-uniform.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  B = cellfun(func,C,\"UniformOutput\",false)\n    <\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Applying Functions to Rows or Variables of a Table<\/h1>\n\n\n\n<p>The&nbsp;<code>varfun<\/code>&nbsp;and&nbsp;<code>rowfun<\/code>&nbsp;functions allow you to apply a function to columns or rows of a table, respectively. They have very similar syntax.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Applying a Function to the Rows of a Table<\/h2>\n\n\n\n<p><code>rowfun<\/code>&nbsp;allows you to perform calculations on rows.<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/d0b62dee-edf4-4c5e-b6d2-c94bc683e9b5\" alt=\"Table Functions\"><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; B = rowfun(func,tbl)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>B<\/code><\/td><td>A table or timetable where the i<sup>th<\/sup>&nbsp;row is equal to&nbsp;<code>func(A{i,:})<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>func<\/code><\/td><td>A function to apply to rows of the table.<\/td><\/tr><tr><td><code>tbl<\/code><\/td><td>A table or timetable.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The following name-value pairs can be used with both&nbsp;<code>rowfun<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>\"InputVariables\"<\/code>: Specify which variables to pass to&nbsp;<code>func<\/code>&nbsp;as a string array. These elements are passes as separate inputs to the function.<\/li><li><code>\"GroupingVariables\"<\/code>: Specify one or more variables that define groups of rows as a string array.<\/li><li><code>\"OutputVariableNames\"<\/code>: Specify the names for the outputs of&nbsp;<code>func<\/code>.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Applying a Function to the Variables of a Table<\/h2>\n\n\n\n<p><code>varfun<\/code>&nbsp;allows you to perform calculations on specific variables.<img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/164bfbef-9c82-4b5e-b2ae-c42de31ba108\" alt=\"Table Functions\"><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt;&gt; B = varfun(func,tbl)<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>B<\/code><\/td><td>A table or timetable containing the calculations on the specified columns.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>func<\/code><\/td><td>A function to apply to columns of the table.<\/td><\/tr><tr><td><code>tbl<\/code><\/td><td>A table or timetable.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The following name-value pairs can be used with both&nbsp;<code>varfun<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>\"InputVariables\"<\/code>: Specify which variables to pass to&nbsp;<code>func<\/code>&nbsp;as a string array. These elements are passes as separate inputs to the function.<\/li><li><code>\"GroupingVariables\"<\/code>: Specify one or more variables that define groups of rows as a string array.<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Structuring Heterogeneous Data<\/li><li>Extracting Multiple Elements from Cell and Structure Arrays<\/li><li>Function Handles<\/li><li>Applying Scalar Functions to Arrays<\/li><li>Converting Data Types<\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">Converting Data Types<\/h1>\n\n\n\n<p>MATLAB provides conversion functions of the form&nbsp;<em><code>typeA2typeB<\/code><\/em>&nbsp;to convert between datatypes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-16-1.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6397\"\/><\/figure>\n\n\n\n<p>&nbsp;The table below summarizes most of the functions available in MATLAB to convert between data types.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-12.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6387\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">4. Optimizing Your Code<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Data Types and Memory<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Data Types with Fixed Memory Requirement<\/h2>\n\n\n\n<p>Some homogeneous data types require a fixed amount of memory per element.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-1.jpeg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6386\"\/><\/figure>\n\n\n\n<p>The amount of memory required by a data type increases<br>with the range or precision of values that the data type can express.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Container Data Types<\/h2>\n\n\n\n<p>Container variables (tables, cell arrays, and structure arrays) require overhead in addition to the data they store. This additional memory is used to store information about the contents of the variable. The amount of the overhead depends on the size of the variable.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-10-3.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6400\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-5-3.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6390\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-10-2.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6392\"\/><\/figure>\n\n\n\n<p>Each cell of a cell array requires memory overhead.<\/p>\n\n\n\n<p>Product or brand names of cars are trademarks or registered trademarks of their respective holders.<\/p>\n\n\n\n<p>In the example below, you can see how to calculate the total memory of a cell array of character vectors.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">headquarters = 'Natick, MA';<\/pre>\n\n\n\n<p>Data Type &#8211;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>char<\/strong><\/pre>\n\n\n\n<p>Memory &#8211; 20 Bytes<br>(10 characters, 2 bytes each)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">headquarters = {'Natick, MA'};<\/pre>\n\n\n\n<p>Data Type &#8211;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>cell<\/strong><\/pre>\n\n\n\n<p>Memory &#8211; 132 Bytes<br>(112 bytes for cell array element,<br>20 bytes for characters)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">headquarters = {'Natick' 'MA'}<\/pre>\n\n\n\n<p>Data Type &#8211;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>cell<\/strong><\/pre>\n\n\n\n<p>Memory &#8211; 240 Bytes<br>(112 bytes for each element of the cell array,<br>12 + 4 bytes for the character vectors)<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Preallocation<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Preallocating Numeric Arrays<\/h2>\n\n\n\n<p>You can use the functions&nbsp;<code>zeros<\/code>&nbsp;and&nbsp;<code>ones<\/code>&nbsp;to preallocate numeric arrays.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>By default,&nbsp;<code>zeros<\/code>&nbsp;and&nbsp;<code>ones<\/code>&nbsp;create an array having the datatype&nbsp;<code><strong>double<\/strong><\/code>.<\/td><td><\/td><td>x = zeros(1,50000);<\/td><\/tr><tr><td>You can create an array having other datatypes by specifying an additional input.<\/td><td><\/td><td>x = zeros(1,50000,&#8217;single&#8217;); y = zeros(1,50000,&#8217;int16&#8242;);<\/td><\/tr><tr><td>Another way to preallocate an array is to assign a value to the last element of the array.<\/td><td><\/td><td>x(8) = 3; x = 0 0 0 0 0 0 0 3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Preallocating Cells and Structures<\/h2>\n\n\n\n<p>You can also preallocate non-numeric data types, such as cell arrays and structure arrays.Think of these arrays as consisting of the containers (cells and structures) and the contents (any datatype and size).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image.jpeg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6371\"\/><\/figure>\n\n\n\n<p>Preallocating a cell array or a structure array assigns space for the containers themselves, not the contents. This means that preallocation of the container variables is most beneficial when the container array itself is large, regardless of the size of the contents of the individual containers.You can preallocate a cell array using the function&nbsp;<code><strong>cell<\/strong><\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>C = <strong>cell<\/strong>(1,4);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/0a76fbf9-4cff-4696-839f-7122cb836fc2\" alt=\"cell array headers\" width=\"300px\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>&nbsp;To preallocate a structure array, start by defining the last element of the array. MATLAB will automatically replicate the field names to all of the preceding elements in the array.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>S(5) = <strong>struct<\/strong>(&#8216;field1&#8242;,6,&#8217;field2&#8217;,7)<\/td><td><img decoding=\"async\" src=\"blob:https:\/\/gulfthai.com\/360eeb09-eba2-4cc8-8b69-e79dfd3a4466\" alt=\"structure array\" width=\"300px\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary &#8211; Optimizing Your Code<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Measuring Performance and Finding Bottlenecks<\/h2>\n\n\n\n<p>To measure the execution time of MATLAB code, you can use the&nbsp;<code>tic<\/code>&nbsp;and&nbsp;<code>toc<\/code>&nbsp;functions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Start timer<\/td><td><\/td><td>tic<\/td><\/tr><tr><td>Run code<\/td><td><\/td><td>x = rand(1000);<\/td><\/tr><tr><td>Stop timer, report results<\/td><td><\/td><td>tocElapsed time is 1.206429 seconds.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To improve the performance of your code, you should first understand what parts of it take the most time. The MATLAB Profiler analyzes where your code spends the most time.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-10-1.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6384\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using Vectorized Operations<\/h2>\n\n\n\n<p>Vectorized code is more concise and faster than the non-vectorized solutions.<strong>Using a&nbsp;<code>for<\/code>&nbsp;loop<\/strong><\/p>\n\n\n\n<p>nonVectorized.mlx<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">% Generate datar&nbsp;=&nbsp;rand(1,5000);&nbsp;% Compute the difference between% the adjacent elementsd&nbsp;=&nbsp;zeros(1,4999);for&nbsp;i=1:4999d(i)&nbsp;=&nbsp;r(i+1)-r(i);end<\/pre>\n\n\n\n<p><strong>Using vectorization<\/strong><\/p>\n\n\n\n<p>vectorized.mlx<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">% Generate datar&nbsp;=&nbsp;rand(1,5000);&nbsp;% Compute the difference between% the adjacent elementsd&nbsp;=&nbsp;diff(r);<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Improving Memory Usage in Functions<\/h2>\n\n\n\n<p>Scripts and functions that call each other often need to share data. Passing inputs to functions is one way functions can share data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-17.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6398\"\/><\/figure>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">5. Creating Flexible Functions<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Allowing Different Input Types<\/h1>\n\n\n\n<p>In some cases, you can leave inputs in their original type. For example, many mathematical operations will work on any numeric type. MATLAB also performs some conversions as needed. For example, numeric variables can be used in logical contexts, in which case they are automatically converted to logical (with zero becoming false and all non-zero becoming true).In other cases, you can use conversion functions to force any allowed input type into the desired type.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Representations of Data Types<\/h2>\n\n\n\n<p>Multiple data types that can hold the same piece of information.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Data<\/th><th>Potential representations<\/th><\/tr><\/thead><tbody><tr><td>Text<\/td><td>Char, string, cell array of char vectors<\/td><\/tr><tr><td>Numbers<\/td><td>Any numeric type (<code><strong>double<\/strong><\/code>,&nbsp;<code><strong>single<\/strong><\/code>,&nbsp;<code>int*<\/code>,&nbsp;<code>uint*<\/code>)<\/td><\/tr><tr><td>Dates<\/td><td>Datetime, numeric array (representing components, such as day, month, year), text<\/td><\/tr><tr><td>Discrete categories<\/td><td>Categorical, text, logical (for only two categories), numeric<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Converting Between Data Types<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Data<\/th><th>Conversion functions<\/th><\/tr><\/thead><tbody><tr><td>Text<\/td><td><code><strong>char<\/strong><\/code>,&nbsp;<code>cellstr<\/code>,&nbsp;<code>string<\/code><br><code>convertCharsToStrings<\/code>,<code>convertStringsToChars<\/code><\/td><\/tr><tr><td>Numbers<\/td><td><code><strong>double<\/strong><\/code>,&nbsp;<code><strong>single<\/strong><\/code>,&nbsp;<code>int*<\/code>,&nbsp;<code>uint*<\/code><\/td><\/tr><tr><td>Dates<\/td><td><code>datetime<\/code><\/td><\/tr><tr><td>Discrete categories<\/td><td><code>categorical<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Note that these functions all leave the inputs unchanged if they are already in the desired type.<br>That is, if&nbsp;<code>t<\/code>&nbsp;is a datetime variable,&nbsp;<code>t&nbsp;=&nbsp;datetime(t);<\/code>&nbsp;will have no effect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Converting Text Inputs<\/h2>\n\n\n\n<p>The&nbsp;<code>convertCharsToStrings<\/code>&nbsp;and&nbsp;<code>convertStringsToChars<\/code>&nbsp;functions convert all text inputs to one uniform type with a single function call.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td>[a,b,c,d] = convertCharsToStrings({&#8216;hello&#8217;,&#8217;world&#8217;},42,[&#8220;this&#8221;;&#8221;is&#8221;;&#8221;text&#8221;],&#8217;so is this&#8217;) a = 1\u00d72 string array &#8220;hello&#8221; &#8220;world&#8221; b = 42 c = 3\u00d71 string array &#8220;this&#8221; &#8220;is&#8221; &#8220;text&#8221; d = &#8220;so is this&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Only the text data types were converted to strings. The variable&nbsp;<code>b<\/code>&nbsp;is type&nbsp;<code><strong>double<\/strong><\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Querying Inputs<\/h1>\n\n\n\n<p>MATLAB includes&nbsp;<a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/is.html\" target=\"_blank\" rel=\"noreferrer noopener\">numerous functions<\/a>&nbsp;that test a particular attribute of a variable and return a logical result. These function names typically start with the word&nbsp;<code>is<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Querying Data Type<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Returns<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isnumeric.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isnumeric<\/code><\/a><\/td><td>True if input is numeric (single, double, int*, uint*)<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isfloat.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isfloat<\/code><\/a><\/td><td>True if input is of floating point type (single or double)<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isinteger.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isinteger<\/code><\/a><\/td><td>True if input is of integer type (int* or uint*)<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/ischar.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>ischar<\/code><\/a><\/td><td>True if input is of char type<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isstring.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isstring<\/code><\/a><\/td><td>True if input is of string type<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/iscellstr.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>iscellstr<\/code><\/a><\/td><td>True if input is a cell array of char vectors<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isdatetime.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isdatetime<\/code><\/a><\/td><td>True if input is a datetime<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isduration.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isduration<\/code><\/a><\/td><td>True if input is a duration<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/iscalendarduration.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>iscalendarduration<\/code><\/a><\/td><td>True if input is a calendar duration<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/islogical.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>islogical<\/code><\/a><\/td><td>True if input is of logical type<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/iscategorical.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>iscategorical<\/code><\/a><\/td><td>True if input is of categorical type<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/istable.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>istable<\/code><\/a><\/td><td>True if input is a table<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/istimetable.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>istimetable<\/code><\/a><\/td><td>True if input is a timetable<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/iscell.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>iscell<\/code><\/a><\/td><td>True if input is a cell array<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isstruct.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isstruct<\/code><\/a><\/td><td>True if input is a structure<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isa.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isa<\/code><\/a><\/td><td>True if input is of a specified data type<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/class.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>class<\/code><\/a><\/td><td>Name of the input data type<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Querying Size and Shape<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Returns<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/size.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>size<\/code><\/a><\/td><td>Array size<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/length.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>length<\/code><\/a><\/td><td>Length of largest array dimension<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/double.numel.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>numel<\/code><\/a><\/td><td>Total number of array elements<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/double.ndims.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>ndims<\/code><\/a><\/td><td>Number of array dimensions<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isempty.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isempty<\/code><\/a><\/td><td>True if input is empty<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isscalar.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isscalar<\/code><\/a><\/td><td>True if input is a scalar<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isvector.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isvector<\/code><\/a><\/td><td>True if input is a vector<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/ismatrix.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>ismatrix<\/code><\/a><\/td><td>True if input is a matrix<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/isrow.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>isrow<\/code><\/a><\/td><td>True if input is a row vector<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/iscolumn.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>iscolumn<\/code><\/a><\/td><td>True if input is a column vector<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary &#8211; Creating Flexible Functions<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Creating Multiple Interfaces<\/h2>\n\n\n\n<p>Use multiple wrapper functions that use the same underlying algorithm. Each wrapper function can present a different interface to users for different applications.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-17-1.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6399\"\/><\/figure>\n\n\n\n<p>Most users can use&nbsp;<code>interface2<\/code>. Advanced users can use&nbsp;<code>advancedInterface<\/code>&nbsp;(or call the algorithm directly).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting Default Inputs<\/h2>\n\n\n\n<p>To check if all the inputs were provided in the function call, you can use the function&nbsp;<code>nargin<\/code>. When called within the function body,&nbsp;<code>nargin<\/code>&nbsp;returns the number of inputs that were passed when the function was called.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/nargin.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>nargin<\/code><\/a>Number of input arguments<br>To allow the users to specify certain inputs (but not others), use an empty array&nbsp;<code>[]<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>In the function body &#8211; check if the input is empty using the function&nbsp;<code>isempty<\/code>. If it is empty, assign a default value.<\/li><li>In the function call &#8211; use an empty array&nbsp;<code>[]<\/code>&nbsp;instead of the input value.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Function Call<\/strong>loanint = interest(500,[],3.1,&#8221;compound&#8221;)<\/td><td><strong>Editor<\/strong>function int = interest(p,n,r,type) if isempty(n) n = 12; end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Variable Length Input Arguments<\/h2>\n\n\n\n<p>You can map multiple input arguments (e.g. a set of name-value pairs) to a single input variable&nbsp;<code>varargin<\/code>&nbsp;in the function definition.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Function Call<\/strong>analyzeAndPlot(time,position,&#8221;LineWidth&#8221;,3,&#8221;Color&#8221;,&#8221;r&#8221;)<\/td><td><strong>Editor<\/strong>function analyzeAndPlot(x,y,varargin)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Matching Text Inputs<\/h2>\n\n\n\n<p>Use&nbsp;<code>validatestring<\/code>&nbsp;to ensure that any user input is exactly as you expect (including type and capitalization), without overly constraining your user. If the input text does not unambiguously match any of the valid strings,&nbsp;<code>validatestring<\/code>&nbsp;generates an error.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td>str = validatestring(&#8220;distribution&#8221;,[&#8220;DistanceMetric&#8221;,&#8221;DistributionName&#8221;,&#8221;NumSamples&#8221;])&nbsp;str = &#8220;DistributionName&#8221;<br>str = validatestring(&#8220;dist&#8221;,[&#8220;DistanceMetric&#8221;,&#8221;DistributionName&#8221;,&#8221;NumSamples&#8221;])&nbsp;Expected input to match one of these values: &#8220;DistanceMetric&#8221;, &#8220;DistributionName&#8221;, &#8220;NumSamples&#8221; The input, dist, matched more than one valid value.<br>str = validatestring(&#8220;Algorithm&#8221;,[&#8220;DistanceMetric&#8221;,&#8221;DistributionName&#8221;,&#8221;NumSamples&#8221;])&nbsp;Expected input to match one of these values: &#8220;DistanceMetric&#8221;, &#8220;DistributionName&#8221;, &#8220;NumSamples&#8221; The input, &#8220;Algorithm&#8221;, did not match any of the valid values.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Variable Number of Outputs<\/h2>\n\n\n\n<p>Similar to how you handle a variable number of inputs, you can use&nbsp;<code>nargout<\/code>&nbsp;to determine how many outputs were requested when a function was called. You can use&nbsp;<code>varargout<\/code>&nbsp;to represent any number of output arguments.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Function Call<\/strong>[x,y,z] = myfun(1,2,3)<\/td><td><strong>Editor<\/strong>function [a,varargout] = myfun(p,q,r)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">6. Creating Robust Applications<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary &#8211; Creating Robust Applications<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Private Functions<\/h2>\n\n\n\n<p>To prevent your application&#8217;s internal functions from being accessible outside the application, you can place them in a folder named&nbsp;<code>private<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-15-3.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6396\"\/><\/figure>\n\n\n\n<p>A private folder is just a regular folder with the name&nbsp;<code>private<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Local Functions<\/h2>\n\n\n\n<p>To create local functions, place them below the primary function in the same code file.findShapes.mlx<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function&nbsp;findShapes&nbsp;%Primary function...end&nbsp;function&nbsp;detectCircle&nbsp;%Local function...end&nbsp;function&nbsp;detectSquare&nbsp;%Local function...end<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Generating Custom Warning and Errors<\/h2>\n\n\n\n<p>You can use the&nbsp;<code>warning<\/code>&nbsp;and&nbsp;<code>error<\/code>&nbsp;functions to generate custom warnings and errors.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/warning.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>warning<\/code><\/a>Generate a custom warning message<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/error.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>error<\/code><\/a>Generate a custom error message<br><strong>Error<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td>error(&#8220;MyProject:invalidValue&#8221;,&#8230; &#8220;The value must be numeric.&#8221;);<br>The value must be numeric.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Warning<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><td>warning(&#8220;MyProject:ValueOutOfRange&#8221;,&#8230; &#8220;The value must be between 1 and 10.&#8221;)<br>The value was expected to be between 1 and 10.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Validating Function Inputs<\/h2>\n\n\n\n<p>To check multiple attributes of a given input, use the function&nbsp;<code>validateattributes<\/code>.<a href=\"http:\/\/www.mathworks.com\/help\/matlab\/ref\/validateattributes.html\" target=\"_blank\" rel=\"noreferrer noopener\"><code>validateattributes<\/code><\/a>Check multiple attributes of a given variable.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Command Window<\/strong>int = calculateInterest(500,2,-0.03)&nbsp;Expected input to be a scalar with value &gt;= 0.<\/td><td><strong>Editor<\/strong>function interest = calculateInterest(p,n,r) validateattributes(&#8220;r&#8221;,&#8221;numeric&#8221;,&#8230; {&#8216;scalar&#8217;,&#8217;&gt;=&#8217;,0}) &#8230;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Catching and Handling Errors<\/h2>\n\n\n\n<p>The try\/catch construct attempts to run the code within the try block. If an error condition occurs, then the execution is interrupted and switched immediately into the catch block.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">try\n    % Attempt code\ncatch mexc\n    % Backup case \u2013 something went wrong\n    % An MException object called mexc now exists\nend<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">7. Verifying Application Behavior<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Writing a Test Script<\/h1>\n\n\n\n<p>A test script is a MATLAB script that checks that the outputs of MATLAB files are as you expect. To create a test script, use the&nbsp;<code>assert<\/code>&nbsp;function to create tests and separate the tests into sections.Code sections allow you to compile multiple tests into a single file. The section header describes the test.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-14.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6379\"\/><\/figure>\n\n\n\n<p>Each section of a test script maintains its own workspace. Thus, in each section, you must define all needed variables.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-12.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6370\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-11.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6372\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Creating a Test Function<\/h1>\n\n\n\n<p>A test function follows a specific template:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>The name of the main function:starts or ends with the case-insensitive word &#8220;test&#8221;has the same name as the function file.<br>The main function hasno inputsone output, here&nbsp;<code>testA<\/code>. The variable&nbsp;<code>testA<\/code>&nbsp;is a&nbsp;<code>test<\/code>&nbsp;array created by&nbsp;<code>functiontests<\/code>&nbsp;with the input&nbsp;<code>localfunctions<\/code>.<\/td><td><\/td><td>function testA = <em>mainFunctionNameTest<\/em> testA = functiontests(localfunctions); end<\/td><\/tr><tr><td>The local functions:contain the testshave names that start or end with the case-insensitive word &#8220;test&#8221;have a single input, here&nbsp;<code>testCase<\/code><br>Many simple function-based unit tests will not use the input to the local functions, but it should always be included. Tests that verify behavior (e.g. warnings or errors) or allow for shared variables between tests use this input explicitly.<\/td><td><\/td><td>function <em>testName1<\/em>(testCase) % code for test 1 end function <em>testName2<\/em>(testCase) % code for test 2 end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Each test goes in its own local function.You run the test function the same way you run a test script.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">result = runtests(\"mainFunctionNameTest\");<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Verification Functions<\/h1>\n\n\n\n<p>There are many qualification functions available in the function-based testing framework.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Verification functions available for function-based tests<\/th><\/tr><tr><td>verifyClass verifyEmpty verifyEqual verifyError verifyFail verifyFalse verifyGreaterThan verifyGreaterThanOrEqual verifyInstanceOf verifyLength verifyLessThan verifyLessThanOrEqual verifyMatches<\/td><td>verifyNotEmpty verifyNotEqual verifyNotSameHandle verifyNumElements verifyReturnsTrue verifySameHandle verifySize verifySubstring verifyThat verifyTrue verifyWarning verifyWarningFree<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The local test functions have a single input, named&nbsp;<code>testcase<\/code>&nbsp;in the example below. Your test code should use it as the first input to the verification function.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-11.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6373\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Pre- and Post-Test Tasks<\/h1>\n\n\n\n<p>You can add pre- and post-test tasks to your testing function by adding functions with the special names&nbsp;<code>setupOnce<\/code>&nbsp;and&nbsp;<code>teardownOnce<\/code>&nbsp;which have the same signature as the other test functions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>In this example, the test code and the application code are in separate locations. You will use the application folder in the teardown function. So, rather than redefining it, you can save it in the&nbsp;<code>testCase<\/code>&nbsp;variable to the&nbsp;<code>TestData<\/code>&nbsp;property. This property is a structure variable to which you can add fields as you desire. Any fields that are added to this variable are accessible by all functions in the test function file.<\/td><td><\/td><td>function setupOnce(testCase) % save the name of the application folder you will add % to the TestData structure testCase.TestData.appDir = &#8230; fullfile(&#8220;C:&#8221;,&#8221;class&#8221;,&#8221;work&#8221;,&#8221;ApplicationDirectory&#8221;); % add the application folder to the path for testing addpath(testCase.TestData.appDir) end<\/td><\/tr><tr><td>Now, remove the directory from the path in the&nbsp;<code>teardownOnce<\/code>&nbsp;function. See that the variable you previously defined,&nbsp;<code>appDir<\/code>, is accessible through&nbsp;<code>testCase.TestData<\/code>. Note that the structure&nbsp;<code>TestData<\/code>&nbsp;is named automatically, whereas you can name the function input,&nbsp;<code>testCase<\/code>&nbsp;in this example, whatever you want.<\/td><td><\/td><td>function teardownOnce(testCase) % removes the added path rmpath(testCase.TestData.appDir) end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">8. Debugging Your Code<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Suppressing and Fixing Code Analyzer Warnings<\/h1>\n\n\n\n<p>For some warnings, the Code Analyzer can help you automatically fix the code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-16.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6388\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-18.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6391\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-15-2.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6389\"\/><\/figure>\n\n\n\n<p>Mousing over the orange dash or the highlighted portion of the code shows you the code analyzer warning.<\/p>\n\n\n\n<p>When the Code Analyzer does not provide an automatic fix, you can either fix the warning yourself, or suppress it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-8.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6380\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-15.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6377\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-9.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6383\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-15-1.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6382\"\/><\/figure>\n\n\n\n<p>Other issues flagged by the code analyzer do not have a simple fix.<\/p>\n\n\n\n<p>Suppressing warnings can be a helpful way to demonstrate that the issue has been considered. This means developers in the future won&#8217;t spend time worrying about a nonexistent problem with the code.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Debugging Run-Time Errors<\/h1>\n\n\n\n<p>When debugging MATLAB code, a common workflow is as follows.<canvas width=\"720\" height=\"420\"><\/canvas><\/p>\n\n\n\n<p>Note that, before making a fix to your code, you should always stop your debugging session first so that you can save your changes.<\/p>\n\n\n\n<p>If you want to enter debug mode immediately when an uncaught error is generated, you can enable the&nbsp;<strong>Pause on Errors<\/strong>&nbsp;option.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-13.png?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6385\"\/><\/figure>\n\n\n\n<p>Automatically break on an error<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">9. Organizing Your Projects<\/h1>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary &#8211; Organizing Your Projects<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Running Folder Reports<\/h2>\n\n\n\n<p>To run a folder report on the current folder, access the Reports menu from the Current Folder Actions menu.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-19.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6393\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">MATLAB Projects<\/h2>\n\n\n\n<p>MATLAB Projects help manage code spread across multiple files. They are also using for sharing code with others.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gulfthai.com\/wp-content\/uploads\/2021\/10\/image-5-4.jpg?w=640&#038;ssl=1\" alt=\"\" class=\"wp-image-6395\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Source Control<\/h2>\n\n\n\n<p>Source control enables you to keep track of and manage previous versions of your project.<\/p>\n\n\n\n\n\n<p>This course uses Git with MATLAB Projects.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">10. Conclusion<\/h1>\n\n\n\n<!--nextpage-->\n\n\n\n<p><\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<p><\/p>\n\n\n\n<p><strong>MATLAB for Financial Applications <\/strong><br><strong><a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951027238489286\">Virtual 1950 USD \/xx USD (2021)<\/a><\/strong><\/p>\n\n\n\n<p>discontinued on 10 Nov 2021<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Working with the MATLAB User Interface<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Become familiar with the main features of the MATLAB integrated design environment and its user interfaces. Interactively create customized visualizations that can be used for financial reporting.Importing data from filesSaving and loading variablesVisualizing data interactivelyExploring and customizing graphicsSharing graphical results<\/td><\/tr><tr><td><strong>Variables and Commands<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Enter MATLAB commands, with an emphasis on creating and accessing numeric and text data. Collect MATLAB commands into code files for reproduction and automation. Learn how to perform tasks such as data import, analysis, and report generation.Entering commandsCreating numeric and text variablesFinding help and documentationImporting data programmaticallyAccessing and modifying values in variablesCreating and running scripts<\/td><\/tr><tr><td><strong>Visualizing Results<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Create informative visualizations of numeric and time-based data. Enhance the appearance of charts by customizing graphics and annotations.Visualizing dataCustomizing graphics optionsWorking with individual graphics componentsAnnotationConverting between numbers and text<\/td><\/tr><tr><td><strong>Data Analysis<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Perform mathematical and statistical calculations on numerical data. Use MATLAB syntax to perform preprocessing and analysis tasks on multiple price series with single commands.Performing calculations on dataInterpreting matrix dataUsing matrices for analysis<br><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Dates and Times<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use variables to represent and manipulate dates and time durations. Extract components of dates and durations as numeric variables.Representing dates and durationsPerforming calculations with dates and durationsExtracting numeric components of dates and durationsPlotting with dates<\/td><\/tr><tr><td><strong>Working with Tabular Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Import data as a MATLAB table. Work with tabular financial datasets that include mixed data types.Storing data in tablesExtracting data from tablesModifying tablesTable operationsExporting data from tables<\/td><\/tr><tr><td><strong>Conditional Data Selection<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Analyze subsets of data that satisfy given criteria. Perform fast data extraction and manipulation using logical variables.Defining logical conditions using logical operatorsExtracting and filtering data by indexing with a logical variableIdentifying and counting subsets of dataManaging discrete variables using categorical arrays<\/td><\/tr><tr><td><strong>Programming Flow Control<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Create flexible code that can interact with the user, make decisions, and adapt to different situations. Automate tasks using programming constructs.Managing command-driven and graphical interaction with a userControlling program flow using conditional programming constructsPerforming iterative tasks using loops<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Working with Missing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Perform statistical calculations on data with missing values. Identify, remove, and replace missing values in a data set.Locating missing valuesIgnoring, removing, and replacing missing values<\/td><\/tr><tr><td><strong>Customizing Graphics<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Create charts comprising multiple graphics components. Use color, text, and data manipulation techniques to produce eye-catching visualizations.Working with the MATLAB graphics hierarchyAccessing and modifying individual graphics componentsManaging graphical tables<\/td><\/tr><tr><td><strong>Fitting Models to Empirical Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Preprocess data prior to model fitting. Fit probability distributions and linear models to data. Generate random numbers from a theoretical or fitted distribution.Fitting linear regression modelsFitting probability distributionsSimulating from distribution fits<\/td><\/tr><tr><td><strong>Increasing Automation with Functions<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Increase automation by encapsulating modular tasks as user-defined functions. Understand how MATLAB resolves references to files and variables. Explore MATLAB tools for debugging code.Creating and calling functionsManaging data in workspacesWriting plain text code filesManaging the MATLAB pathDebugging code filesSimplifying interfaces using structures<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Intermediate Courses<\/strong><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-for-data-processing-and-visualization.html\">MATLAB for Data Processing and Visualization<\/a><br><strong><a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951020515156625\">Virtual xx USD \/xx USD (2021)<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Importing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Read text files that contain a mixture of data types, delimiters, and headers.Import a mixture of data types from arbitrarily formatted text filesImport only required columns of data from a text fileImport and merge data from multiple files<\/td><\/tr><tr><td><strong>Processing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Process raw imported data by extracting, manipulating, aggregating, and counting portions of data.Process data with missing elementsCreate and modify categorical arraysAggregate, bin, and count groups of data<\/td><\/tr><tr><td><strong>Customizing Visualizations<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Annotate and modify standard plots to produce informative customized graphics.Determine properties of graphics objects and their associated valuesLocate and manipulate graphics objectsCustomize plots by modifying properties of graphics objects<\/td><\/tr><tr><td><strong>Working with Irregular Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Import and visualize scattered data from text files with irregular formatting.Parse text files to determine formattingImport data from separate sections of a text fileExtract data from container variablesInterpolate irregularly spaced three-dimensional dataVisualize three-dimensional data in two and three dimensions<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-programming-techniques.html\">MATLAB Programming Techniques<\/a><br><strong><a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951032681822075\">Virtual 750 USD \/750 USD (2021)<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Running an Optimization Problem<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Understand the basic structure and process of solving optimization problems effectively. Use interactive tools to define and solve optimization problems.Identifying the problem componentsRunning an optimization using the Live Editor Optimization TaskApplying the optimization processUsing optimization functions<\/td><\/tr><tr><td><strong>Specifying Objective Functions and Constraints<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Write an optimization problem. Use problem-based workflow to arrive at a solution.Using the problem-based workflowSpecifying objective functions and constraintsIdentifying different types of constraints<\/td><\/tr><tr><td><strong>Choosing a Solver and Improving Performance<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Select an appropriate solver and algorithm by considering the type of optimization problem to be solved. Interpret the output from the solver and diagnose the progress of an optimization.Classifying the objectiveChoosing a solver and algorithmExamining and interpreting the resultProviding derivative information<\/td><\/tr><tr><td><strong>Global and Multiobjective Optimization<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use Global Optimization Toolbox functionality to solve problems where classical algorithms fail or work inefficiently. Solve problems with many objectives.Finding the global minimumUsing genetic algorithms, direct search methods and surrogate optimizationUse multiobjective solvers<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.mathworks.com\/training-schedule\/machine-learning-with-matlab.html\">Machine Learning with MATLAB<\/a><br><strong><a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951030121822331\">Virtual 1500 USD \/ 350 USD (2021)<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Importing and Organizing Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Bring data into MATLAB and organize it for analysis, including normalizing data and removing observations with missing values.Data typesTablesCategorical dataData preparation<\/td><\/tr><tr><td><strong>Finding Natural Patterns in Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use unsupervised learning techniques to group observations based on a set of explanatory variables and discover natural patterns in a data set.Unsupervised learningClustering methodsCluster evaluation and interpretation<\/td><\/tr><tr><td><strong>Building Classification Models<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use supervised learning techniques to perform predictive modeling for classification problems. Evaluate the accuracy of a predictive model.Supervised learningTraining and validationClassification methods<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Improving Predictive Models<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Reduce the dimensionality of a data set. Improve and simplify machine learning models.Cross validationHyperparameter optimizationFeature transformationFeature selectionEnsemble learning<\/td><\/tr><tr><td><strong>Building Regression Models<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use supervised learning techniques to perform predictive modeling for continuous response variables.Parametric regression methodsNonparametric regression methodsEvaluation of regression models<\/td><\/tr><tr><td><strong>Creating Neural Networks<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Create and train neural networks for clustering and predictive modeling. Adjust network architecture to improve performance.Clustering with Self-Organizing MapsClassification with feed-forward networksRegression with feed-forward networks<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><a href=\"https:\/\/www.mathworks.com\/training-schedule\/deep-learning-with-matlab.html\">Deep Learning with MATLAB<\/a><\/strong><br><strong><a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951031078488902\"> Virtual 1500 USD \/350 USD (2021)<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Transfer Learning for Image Classification<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Perform image classification using pretrained networks. Use transfer learning to train customized classification networks.Pretrained networksImage datastoresTransfer learningNetwork evaluation<\/td><\/tr><tr><td><strong>Interpreting Network Behavior<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Gain insight into how a network is operating by visualizing image data as it passes through the network. Apply this technique to different kinds of images.ActivationsFeature extraction for machine learning<\/td><\/tr><tr><td><strong>Creating Networks<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Build convolutional networks from scratch. Understand how information is passed between network layers and how different types of layers work.Training from scratchNeural networksConvolution layers and filters<\/td><\/tr><tr><td><strong>Training a Network<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Understand how training algorithms work. Set training options to monitor and control training.Network trainingTraining progress plotsValidation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Improving Network Performance<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Choose and implement modifications to training algorithm options, network architecture, or training data to improve network performance.Training optionsDirected acyclic graphsAugmented datastores<\/td><\/tr><tr><td><strong>Performing Image Regression<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Create convolutional networks that can predict continuous numeric responses.Transfer learning for regressionEvaluation metrics for regression networks<\/td><\/tr><tr><td><strong>Using Deep Learning for Computer Vision<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Train networks to locate and label specific objects within images.Image application workflowObject detection<\/td><\/tr><tr><td><strong>Classifying Sequence Data<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Build and train networks to perform classification on ordered sequences of data, such as time series or sensor data.Long short-term memory networksSequence classificationSequence preprocessingCategorical sequences<\/td><\/tr><tr><td><strong>Generating Sequences of Output<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Use recurrent networks to create sequences of predictions.Sequence to sequence classificationSequence forecasting<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong><a href=\"https:\/\/www.mathworks.com\/training-schedule\/image-processing-with-matlab.html\">Image Processing with MATLAB<\/a><\/strong><br><strong> <a href=\"https:\/\/www.facebook.com\/SiamWise\/posts\/2951035645155112\">1500 USD \/350 USD (2021)<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Importing and Visualizing Images<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Import and visualize different image types in MATLAB. Manipulate images for streamlining subsequent analysis steps.Importing, inspecting, and displaying imagesConverting between image typesVisualizing results of processingExporting images<\/td><\/tr><tr><td><strong>Preprocessing Images<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Enhance images for analysis by using common preprocessing techniques such as contrast adjustment and noise filtering.Adjusting contrastReducing noise with spatial filteringEqualizing inhomogeneous backgroundProcessing images in distinct blocksMeasuring image quality<\/td><\/tr><tr><td><strong>Color and Texture Segmentation<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Segment objects from an image based on color and texture. Use statistical measures to characterize texture features and measure texture similarity between images.Transforming between image color spacesSegmenting objects based on color attributes and color differenceSegmenting objects based on texture using nonlinear filtersAnalyzing image texture using statistical measures like contrast and correlation<\/td><\/tr><tr><td><strong>Improving Segmentation<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Improve binary segmentation results by refining the segmentation mask. Use interactive and iterative techniques to segment image regions.Using morphological operations to refine segmentation masksSegmenting images and refining results interactivelyUsing iterative techniques to evolve segmentation from a seed<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Finding and Analyzing Objects<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Count and label objects detected in a segmentation. Measure object properties like area, perimeter, and centroids.Extracting and labeling objects in a segmentation maskMeasuring shape propertiesSeparating adjacent and overlapping objects with watershed transform<\/td><\/tr><tr><td><strong>Detecting Edges and Shapes<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Detect edges of objects and extract boundary pixel locations. Detect objects by shapes such as lines and circles.Detecting object edgesIdentifying objects by detecting lines and circlesPerforming batch analysis over sets of images<\/td><\/tr><tr><td><strong>Spatial Transformation and Image Registration<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Compare images with different scales and orientations by geometrically aligning them.Applying geometric transformations to imagesAligning images using phase correlationAligning images using point mapping<\/td><\/tr><tr><td><strong>Automating Image Registration with Image Features<\/strong><\/td><td><strong>Objective:&nbsp;<\/strong>Detect, extract, and match sets of image features to automate image registration.Detecting and extracting featuresMatching features to estimate geometric transformation between two images<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>xxx&#8230;. xx USD \/xx USD (2021)<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/gulfthai.com\/?page_id=3428\">Matlab &amp; Simulink Basic Programming<\/a> &#8211; Online \u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22<\/p>\n\n\n\n<p><a href=\"https:\/\/www.mathworks.com\/training-schedule\/simulink-for-system-and-algorithm-modeling.html\">https:\/\/www.mathworks.com\/training-schedule\/simulink-for-system-and-algorithm-modeling.html<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MATLAB Products<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Fundamental Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-fundamentals.html\">MATLAB Fundamentals<\/a><\/td><td>3 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-fundamentals-for-automotive-applications.html\">MATLAB Fundamentals for &nbsp;Automotive Applications<\/a><\/td><td>3 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-for-financial-applications.html\">MATLAB for Financial Applications<\/a><\/td><td>3 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-fundamentals-for-aerospace-applications.html\">MATLAB Fundamentals for Aerospace Applications<\/a><\/td><td>3 days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Intermediate Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/wireless-communications-systems-design-with-matlab-and-usrp.html\">Wireless Communications Systems Design with MATLAB and USRP Software-Defined Radios<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/machine-learning-with-matlab.html\">Machine Learning with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/deep-learning-with-matlab.html\">Deep Learning with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/time-series-modeling-in-matlab.html\">Time-Series Modeling in MATLAB<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-for-data-processing-and-visualization.html\">MATLAB for Data Processing and Visualization<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-programming-techniques.html\">MATLAB Programming Techniques<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/statistical-methods-in-matlab.html\">Statistical Methods in MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/optimization-techniques-in-matlab.html\">Optimization Techniques in MATLAB<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/image-processing-with-matlab.html\">Image Processing with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/building-interactive-applications-in-matlab.html\">Building Interactive Applications in MATLAB<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/processing-big-data-with-matlab.html\">Processing Big Data with MATLAB<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/accelerating-and-parallelizing-matlab-code.html\">Accelerating and Parallelizing MATLAB Code<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/signal-preprocessing-and-feature-extraction-for-data-analytics-w.html\">Signal Preprocessing and Feature Extraction for Data Analytics with MATLAB<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/signal-processing-with-matlab.html\">Signal Processing with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/computer-vision-with-matlab.html\">Computer Vision with MATLAB<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/automated-driving-with-matlab.html\">Automated Driving with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/object-oriented-programming-with-matlab.html\">Object-Oriented Programming with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/predictive-maintenance-with-matlab\">Predictive Maintenance with MATLAB<\/a><\/td><td>2 days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Advanced Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-to-c-with-matlab-coder.html\">MATLAB to C with MATLAB Coder<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/designing-lte-and-lte-advanced-physical-layer-systems-with-matlab.html\">Designing LTE and LTE Advanced Physical Layer Systems with MATLAB<\/a><\/td><td>3 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/upgrading-from-lte-to-5g-with-matlab.html\">Upgrading from LTE to 5G with MATLAB<\/a><\/td><td>1 day<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Simulink Products<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Fundamental Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/simulink-for-system-and-algorithm-modeling.html\">Simulink for System and Algorithm Modeling<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/simulink-for-automotive-system-design.html\">Simulink for Automotive System Design<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/model-based-design-introduction.html\">Model-Based Design Introduction<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/signal-processing-with-simulink.html\">Signal Processing with Simulink<\/a><\/td><td>3 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/simulink-for-aerospace-system-design.html\">Simulink for Aerospace System Design<\/a><\/td><td>2 days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Intermediate Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/communication-systems-modeling-with-simulink.html\">Communication Systems Modeling with Simulink<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/control-system-design-with-matlab-and-simulink.html\">Control System Design with MATLAB and Simulink<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/integrating-code-with-simulink.html\">Integrating Code with Simulink<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/modeling-physical-systems-with-simscape.html\">Modeling Physical Systems with Simscape<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/modeling-driveline-systems-with-simscape.html\">Modeling Driveline Systems with Simscape<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/modeling-fluid-systems-with-simscape.html\">Modeling Fluid Systems with Simscape<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/modeling-electrical-power-systems-with-simscape.html\">Modeling Electrical Power Systems with Simscape<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/modeling-multibody-mechanical-systems-with-simscape.html\">Modeling Multibody Mechanical Systems with Simscape<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/power-electronics-control-design-with-simulink-and-simscape\">Power Electronics Control Design with Simulink and Simscape<\/a><\/td><td>1 day<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th><strong>Advanced Courses<\/strong><\/th><th><strong>Length<\/strong><\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/programming-xilinx-zynq-socs-with-matlab-and-simulink-virtual.html\">Programming Xilinx Zynq SoCs with MATLAB and Simulink<\/a><\/td><td>4 half days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/embedded-linux-and-system-integration-for-zynq.html\">Embedded Linux and System Integration with Zynq<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/simulation-based-testing-with-simulink.html\">Simulation-Based Testing with Simulink<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/simulink-model-management-and-architecture.html\">Simulink Model Management and Architecture<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/design-verification-with-simulink\">Design Verification with Simulink<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/generating-hdl-code-from-simulink.html\">Generating HDL Code from Simulink<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/dsp-for-fpgas.html\">DSP for FPGAs<\/a><\/td><td>3 days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Stateflow<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Fundamental Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/stateflow-for-logic-driven-system-modeling.html\">Stateflow for Logic Driven System Modeling<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/stateflow-for-automotive-applications.html\">Stateflow for Automotive Applications<\/a><\/td><td>2 days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Code Generation Products<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Fundamental Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/testing-generated-code-in-simulink.html\">Testing Generated Code in Simulink<\/a><\/td><td>1 day<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Advanced Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/generating-hdl-code-from-simulink.html\">Generating HDL Code from Simulink<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/programming-xilinx-zynq-socs-with-matlab-and-simulink-virtual.html\">Programming Xilinx Zynq SoCs with MATLAB and Simulink<\/a><\/td><td>4 half days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/embedded-linux-and-system-integration-for-zynq.html\">Embedded Linux and System Integration with Zynq<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/embedded-coder-for-production-code-generation-two-day.html\">Embedded Coder for Production Code Generation<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/matlab-to-c-with-matlab-coder.html\">MATLAB to C with MATLAB Coder<\/a><\/td><td>2 days<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/code-generation-for-classic-autosar-software-components\">Code Generation for Classic AUTOSAR Software Components<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/software-defined-radio-with-zynq-using-simulink.html\">Software-Defined Radio with Zynq using Simulink<\/a><\/td><td>1 day<\/td><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/real-time-testing-with-simulink-real-time-and-speedgoat-hardware.html\">Real-Time Testing with Simulink Real-Time and Speedgoat Hardware<\/a><\/td><td>4 half days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Polyspace Products<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Advanced Courses<\/th><th>Length<\/th><\/tr><tr><td><a href=\"https:\/\/www.mathworks.com\/training-schedule\/polyspace-for-c-cpp-code-verification.html\">Polyspace for C\/C++ Code Verification<\/a><\/td><td>2 days<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Matlab Fundamental<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fundamental Courses MATLAB Fundamental Virtual 1950 USD \/500 USD (2021) VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 1 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21)VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 2 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21) VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 3 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21) VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48 4 \u0e42\u0e14\u0e22 \u0e1c\u0e28.\u0e14\u0e23.\u0e01\u0e34\u0e15\u0e15\u0e34\u0e1e\u0e07\u0e29\u0e4c \u0e40\u0e22\u0e32\u0e27\u0e32\u0e08\u0e32 (1-2 \u0e0a\u0e21\/ \u0e40\u0e23\u0e35\u0e22\u0e19\u0e23\u0e39\u0e49\u0e17\u0e14\u0e25\u0e2d\u0e07 3 \u0e0a\u0e21) VDO \u0e2a\u0e2d\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48<br \/><a class=\"read-more\" href=\"https:\/\/gulfthai.com\/?page_id=3457\">Complete Reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3457","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/gulfthai.com\/index.php?rest_route=\/wp\/v2\/pages\/3457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulfthai.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/gulfthai.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/gulfthai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulfthai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3457"}],"version-history":[{"count":15,"href":"https:\/\/gulfthai.com\/index.php?rest_route=\/wp\/v2\/pages\/3457\/revisions"}],"predecessor-version":[{"id":6403,"href":"https:\/\/gulfthai.com\/index.php?rest_route=\/wp\/v2\/pages\/3457\/revisions\/6403"}],"wp:attachment":[{"href":"https:\/\/gulfthai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}