CH 2 - CREATING ARRAYS Flashcards
It is a fundamental form that MATLAB/OCTAVE uses to store and manipulate data. It is a
list of numbers arranged in rows and/or columns.
ARRAY
is a list of numbers arranged in a row or a column.
ONE-DIMENSIONAL ARRAY
creating a vector from a known list of numbers:
variable_name = [ type vector elements ]
To create a row vector, _____________________
TYPE THE ELEMENTS WITH A SPACE OR A COMMA BETWEEN THE ELEMENTS INSIDE THE SQUARE BRACKETS
To create a column vector, ____________
TYPE THE LEFT SQUARE BRACKET AND THEN ENTER THE ELEMENTS WITH A SEMI-COLON BETWEEN THEM, OR PRESS THE ENTER KEY AFTER EACH ELEMENT. TYPE THE RIGHT SQUARE BRACKET AFTER THE LAST ELEMENT
How to type elements in a row (example)?
How to type elements in a column (example)?
year (row)
population (column)
yr=[1984 1985 1986 1987]
pop=[127; 130; 136; 145]