5.2. Data Input

The fundamental data-type in MATLAB is array. It encompasses several distinct data objects—integers, doubles (real numbers), matrices, character strings, structures and cells. There is no need to declare variables as real or complex. When a real/complex number is entered as the value of a variable, MATLAB automatically sets the variable to be real/complex. There are three common ways to input data in MATLAB:

1.
Assign data to different variables through an assignment statement.
2.
Input data from keyboard as per commands displayed on the monitor.
3.
Read data from a file, which has been already stored in the computer’s memory.

5.2.1. Assignment Statement and Variable Declaration

A value can be assigned to a variable by making ...

Get MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.