What is the difference between Matrix and an array ?
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answer ( 1 )
ARRAYS
Arrays can contain greater than or equal to 1 dimensions.
Array is a homogenous data structure.
It is a singular vector arranged into the specified dimensions.
array() function can be used to create matrix by specifying the third dimension to be 1.
Arrays are superset of matrices.
Limited set of collection-based operations.
Mostly, intended for storage of data.
MATRICES
Matrices contains 2 dimensions in a table like structure.
Matrix is also a homogenous data strucrure.
It comprises of multiple equal length vectors stacked together in a table.
matrix() function however can be used to create at most 2-dimensional array.
Matrices are a subset, special case of array where dimensions is two.
Wide range of collection operations possible.
Mostly, matrices are intended for data transformation.