Programming: Organizing Data

version 1.0.2 (176 MB) by Emma Smith Zbarsky
This courseware module addresses working with data: textual data types, numerical data types, data storage, and memory.

6 Downloads

Updated 8 Aug 2022

From GitHub

View License on GitHub

Programming: Organizing Data

View Programming: Organizing Data on File Exchange or Open in MATLAB Online

Curriculum Module
Created with R2022a. Compatible with R2021b and later releases.

Description

This curriculum module contains interactive live scripts that teach fundamental concepts and basic terminology related to programming computers. This module focuses on concepts and practices related to working with data. One script explores textual data types, including strings and character arrays. Another script explores numerical data types, including single- and double-precision floating-point data types, integer data types, and booleans. A third script addresses common efficiency problems that novice coders can encounter if they do not understand how their program is interacting with their computer's memory. The final script addresses data structures, including arrays, tables, structs, and cell arrays, as they naturally arise to store data.

These lessons can be used as part of a lecture, as activities in an instructional setting, or as interactive assignments to be completed outside class.

Get started with the Programming: Organizing Data interactive examples by downloading and unzipping the repository. Then, double-click the OrganizingData.prj file inside MATLAB®. From there, you can follow the landing page instructions to get started with the examples. The instructions inside the live scripts will guide you through the exercises and activities. Get started with each live script by running it one section at a time. To stop running the script or a section midway (for example, if a loop is running longer than intended), click the Stop button in the RUN section of the Live Editor tab in the MATLAB Toolstrip.

Prerequisite Domain Knowledge

This module assumes familiarity with basic programming concepts (e.g., floating-point doubles, strings, constants, vectors, matrices, arrays, and for loops) and how to use them in MATLAB. These ideas are all presented with interactive examples in Fundamentals of Programming. You could also use MATLAB Onramp as another resource to acquire familiarity with MATLAB.

Details

Strings.mlx Open in MATLAB Online

You can define, edit, format, and string together textual data for a computer. This script investigates strings, character arrays, and numeric data types and discusses how they interact in MATLAB. Formatting strings, modifying and extracting substrings, and building composite strings that include the results of numerical calculations are all explored.

In this script, students will...

  • investigate the relationship between character arrays and Unicode values.
  • try building two-dimensional character arrays and string arrays.
  • format strings by concatenating, modifying capitalization, reordering characters, extracting or replacing substrings, or formatting textual data from numerical data.
  • extract the month from a regularly-formatted but randomly generated sentence.

NumericDataTypes.mlx Open in MATLAB Online

Different numeric data types are optimized for different operations. This script investigates the binary number system and how it leads to floating point, integer, and boolean data types.

In this script, students will...

  • create an example illustrating the differences between floating point arithmetic and symbolic arithmetic.
  • explore the results of mathematical operations involving mixed numeric data types.
  • identify the possible values of a 32-bit unsigned integer.
  • use documentation to discover how to perform mathematical computations in MATLAB.

Memory.mlx Open in MATLAB Online

Understanding a little bit about how programs interact with memory can help you to write efficient programs or to understand why an algorithm might be much faster in some implementations than others. This script investigates high-level memory management and demonstrates how to write more memory-efficient code.

One toy example implementing naive matrix multiplication algorithms:

In this script, students will...

  • compare the results of computation organized in memory-efficient and memory-inefficient ways.
  • apply understanding of memory to recognize efficient computational patterns such as pre-allocation.

StoringData.mlx Open in MATLAB Online

Different data storage structures are optimized for different types of data and access. This script facilitates the exploration of arrays, tables, structure arrays, and cell arrays as structures for storing data. Examples include sea surface temperature data and solar power generation data.

In this script, students will...

  • read metadata to understand a dataset.
  • use arrays to store multidimensional data of the same type and access individual elements or sub-arrays using dimensional, logical or linear indexing.
  • use tables to store linked sets of different types of data such as key/value sets and extract information as tables, single variable arrays, or concatenated variable arrays.
  • use structure arrays to store linked data of different types and sizes and use dot notation to access fields within a structure array or variables within a table.
  • recognize cell arrays and extract the data to other data structures.
  • clean data by interpolating missing values.
  • answer questions by analyzing data.
  • convert data between types and structures.

Related Courseware Modules

  • Fundamentals of Programming on GitHub or View Fundamentals-of-Programming on File Exchange or Open in MATLAB Online
  • Programming: Structuring Code on GitHub or View Programming: Structuring Code on File Exchange or Open in MATLAB Online

Products

MATLAB®, Mapping Toolbox™ (StoringData.mlx), Symbolic Math Toolbox™ (Strings.mlx)

License

The license for this module is available in the License.md file in this GitHub repository.

Support

Solutions are available upon instructor request. If you would like to request solutions or have a question, contact the MathWorks online teaching team.

Copyright 2022 The MathWorks, Inc.

Cite As

Emma Smith Zbarsky (2022). Programming: Organizing Data (https://github.com/MathWorks-Teaching-Resources/Programming-Organizing-Data/releases/tag/v1.0.2), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with R2021b and later releases
Platform Compatibility
Windows macOS Linux
Communities
More Files in the  Distance Learning Community

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.