Vectorizing, MATLAB in Statistics

Vectorizing:

In most of the cases in MATLAB, loops are not essential. As MATLAB is written specifically to work with the vectors and matrices, most operations can be completed and functions can be called with the vectors and matrices. However, the term vectorizing is used in MATLAB for rewriting code by using loops in a traditional programming language to the matrix operations in MATLAB.

In many programming languages, whenever performing an operation on a vector, a for loop is used to loop through the whole vector. For illustration, in MATLAB supposing that there is a vector variable vec:

for i = 1:length(vec)

% do something with vec(i)

end

Posted Date: 10/19/2012 3:53:17 AM | Location : United States







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

Write discussion on Vectorizing
Your posts are moderated
Related Questions
fscanf function - file function: The fscanf reads matrix variable mat columnwise from the file specified by fid. The 'format' involves conversion characters much similar to th

Sequential Search: A sequential search is completed by looping through the vector element-by-element starting from the beginning, looking for the key. Usually the index of the

Generic code for Reading from Files: The generic code to complete this is as shown below:   fid = fopen('filename'); if fid == -1    disp('File open not suc

MENU Function: The MATLAB also has a built-in function known as menu which will display a figure Window with push buttons for the choices. The very first string passed to the

Illustration of Customizing plots: Illustration, the bar and barh functions by the default place a width of 0.8 between bars. Whenever called as bar(x,y), the width of 0.8 is

Advanced File Input and output: Where 'format' involves the conversion characters much like those used in the fprintf function. For illustration, to read the file 'subjexp.dat

fopen function - file function: The fopen opens the file for reading. The fscanf then reads each line one double and one character, and put each pair in individual columns in

Areacirc function: The areacirc function can be called from the Command Window as shown here, or from a script. Here is a script which will prompt the user for the radius of o

Logical Built-In Functions: There are built-in functions in the MATLAB which are useful in conjunction with vectors or matrices of all logical true or false values; two of the

Illustration of tracing a error: The one way of following the flow of function, or tracing it, is to use the echo function. The echo function, that is a toggle, will show each