Data Representation in MATLAB: From Raw Data to Insight
Summary
This activity is a hands-on computational lab where students import, validate, inspect, and visualize three heterogeneous data types (spreadsheets, audio, images) to discover MATLAB's unified array-based data representation. Students progress through a complete data analysis pipeline, applying consistent workflows across different data formats to build data literacy and computational thinking skills.
Learning Goals
Content Learning:
- Understand how MATLAB represents diverse data types as arrays
- Master data import functions (readmatrix, readtable, audioread, imread)
- Learn systematic data validation and inspection techniques
MATLAB Skills:
- Demonstrates MATLAB's strength in handling heterogeneous data through a unified array structure
- Introduces specialized toolboxes (Signal Processing, Image Processing) implicitly
- Shows consistent workflow patterns across data domains
Higher-Order Thinking Skills:
- Critical thinking through data quality assessment
- Pattern recognition across different data modalities
- Synthesis of insights from multiple data representations
Additional Skills:
- Technical documentation through Live Script reporting
- Methodical experimental workflow development
Context for Use
Educational Level: Undergraduate introductory courses in engineering, computer science, data science, or physical sciences
Class Size: Suitable for small to medium labs (15–30 students) with individual or paired computing
Activity Type: 2–3 hour guided lab activity with integrated assessment
Technical Prerequisites:
- Basic MATLAB navigation (interface, scripts, variables)
- Elementary programming concepts (functions, data types)
- Basic file management skills
- No prior data analysis experience required
Course Positioning: Ideal as a first data handling lab after basic MATLAB syntax introduction
Adaptability: Easily adaptable to different datasets and disciplinary contexts
Description and Teaching Materials
From Raw Data to Insight
This activity introduces students to computational data analysis through a structured, hands-on lab that explores how MATLAB represents diverse data types using its core array structure. Students progress through a complete data handling pipeline—setup, import, validation, inspection, and visualization—for three common data types: spreadsheet data, audio recordings, and digital images. The consistent workflow across these different formats reinforces the fundamental concept that, in MATLAB, all data ultimately becomes arrays, while teaching practical skills in data literacy and computational thinking.
MATLAB Utilization and Justification
MATLAB is uniquely suited for this activity because it provides a unified environment where the same fundamental concepts (arrays, indexing, visualization) apply consistently across data domains. While other tools might handle individual data types, MATLAB's consistent syntax and integrated environment allow students to recognize patterns and transfer skills more efficiently. The activity leverages MATLAB's strength in handling heterogeneous data through its array-centric paradigm.
Primary Teaching Material
DataRepresentation.pdf (Acrobat (PDF) 230kB Oct19 25) — This comprehensive lab manual serves as the central guide for both students and instructors. It contains:
- Theoretical background on data representation in MATLAB
- Step-by-step instructions for the complete workflow
- Ready-to-use code examples for data import and analysis
- Guided questions for data inspection and interpretation
- Visualization techniques for each data type
- Final synthesis and reporting requirements
- The document is structured to facilitate both independent student work and instructor-led lab sessions.
Supporting Material
- electricityData.xlsx (Excel 2007 (.xlsx) 21kB Oct19 25) — Sample spreadsheet data for the tabular data analysis section, containing electricity consumption and revenue data across multiple regions and sectors.
- DataRepresentation.mlx (MATLAB Live Script 53kB Oct19 25) — Instructor reference Live Script with complete solutions and teaching notes.
Adaptability Notes:
The activity is designed for flexibility—instructors can easily substitute their own spreadsheet data, audio files, or images to tailor the exercise to specific disciplinary contexts (engineering, life sciences, social sciences, etc.). The underlying workflow and learning objectives remain consistent regardless of the specific datasets used.
Teaching Notes and Tips
Implementation Tips:
- Have students complete Part 1 (folder setup) before the lab session to save time.
- Provide each participant with a printed copy of the laboratory manual containing all code examples.
- Students should type out all code and comments themselves rather than copying and pasting from a digital source.
- Begin with a live demonstration of one data import procedure before transitioning to independent work.
- Encourage frequent use of the Workspace window to visualize variable structures
Common Challenges:
- File path issues: Emphasize the importance of the Current Folder setting
- Audio import confusion: Clarify dual output [data, Fs] from audioread
- Image dimension misunderstanding: Use Variable Editor to explore 3D array structure
What students actually do:
- Open their Live Script file.
- Look at the code examples in the lab manual (either on screen or printed)
- Type each command and comment character-by-character into their own file.
- Run the code to check for typing errors
Assessment
Student learning is evaluated through a combination of formative assessment during the lab session and a summative assessment based on the final submitted work. This multi-faceted approach ensures students demonstrate both technical proficiency and conceptual understanding.
Formative Assessment (In-Lab)
During the laboratory session, instructors actively monitor student progress through several checkpoints:
- Task Completion Verification: Instructors circulate to confirm successful completion of key milestones, including data import, basic inspection commands, and generation of required visualizations.
- Think-Pair-Share Discussions: During interpretation questions, instructors listen to student discussions to identify conceptual misunderstandings and gauge depth of understanding.
- Technical Troubleshooting: Observing how students debug errors provides insight into their problem-solving skills and MATLAB familiarity.
Summative Assessment (Final Submission)
The primary assessment is the MATLAB Live Script submission, which is evaluated against three main criteria:
Technical Execution & Code Quality (30%)
- All code runs without errors from beginning to end.
- Proper use of MATLAB functions (readtable, audioread, imread, size, summary, etc.)
- Code is well-commented with clear explanations of each step.
- Appropriate variable naming and script organization
- Successful import and handling of all three data types
Visualization & Output Analysis (40%)
- All required figures are generated (time series plot, box plot, audio waveform, audio histogram, image display, pixel histogram).
- Figures are properly labeled with titles, axis labels, and appropriate formatting.
- Correct answers to all inspection and interpretation questions are provided as text within the Live Script.
Synthesis & Conceptual Understanding (30%)
- The final reflection clearly describes how each data type is represented as arrays in MATLAB.
- The student demonstrates an understanding of the unified data representation concept.
- Meaningful insights are drawn from the validation and visualization steps.
References and Resources
MATLAB Documentation:
- readtable - Tabular data import
- audioread - Audio file reading
- imread - Image file import
- MATLAB Onramp - Free interactive tutorial