Dimensions - matrix, MATLAB in Mathematics

Dimensions - matrix:

The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size function returns the number of rows & columns in a matrix. For matrix, the length function will return either the number of rows or the number of columns, whichever is the maximum. For illustration, the following vector, vec, has 4 elements therefore its length is 4. It is a row vector; hence, the size is 1 × 4.

>> vec = -2:1

vec =

-2  -1  0  1

>> length(vec)

ans =

4

>> size(vec)

ans =

1  4

Posted Date: 10/18/2012 4:28:42 AM | Location : United States







Related Discussions:- Dimensions - matrix, Assignment Help, Ask Question on Dimensions - matrix, Get Answer, Expert's Help, Dimensions - matrix Discussions

Write discussion on Dimensions - matrix
Your posts are moderated
Related Questions
Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Illustration of Labels and prompts: The program below prompts the user for endpoints (x1, y1) and (x2, y2) of a line segment, and computes the midpoint of the line segment, th

Example of Logical built-in functions: For equivalent to all the function, we should make sure that the entire elements in the vector are logically true. The one way of doing

Matrix of Plots: The other function which is very useful with any type of plot is subplot that creates a matrix of plots in the present Figure Window. The three arguments are

User input in the while loop: Here is an illustration of running this script: >> readonenum Enter a positive number: -5 Invalid! Enter a positive number: -2.2

Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector

Strings as Vectors: The Strings are considered as vectors of characters-or in another words, a vector in which each and every element is a single character-so numerous vector

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

Function xlsread - file function: The function xlsread will read from the spreadsheet file. For illustration, to read from file just generated: >> ssnums = xlsread('ranexc

Built-in function for Differentiation: The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration, >>