Colon operator, MATLAB Programming

The Colon Operator:

If the values in the vector are regularly spaced, the colon operator is used to iterate through these values. For illustration, 1:5 results in all the integers from 1 to 5:

>> vec = 1:5

vec =

1  2  3  4  5

Note that in this situation, the brackets [ ] are not essential to define the vector.

With the colon operator, a step value can also be identified with the other colon, in the form (first: step: last). For illustration, to generate a vector with all the integers from 1 to 9 in steps of 2:

>> nv = 1:2:9

nv =

1  3  5  7  9

 

Posted Date: 10/18/2012 4:14:03 AM | Location : United States







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

Write discussion on Colon operator
Your posts are moderated
Related Questions
kind in geometric calculity in space AREA. >

Create MATLAB program(s) that solve a problem of your own choice. You may opt to solve work related problem, an industrial problem, or problem from your research project. Markin

1. Write a function to threshold your images separating the background from the foreground: Implement the "peakiness" detection algorithm described in class. The output of your

Functions which return More than one Value: Functions which return one value have one output argument. The Functions which return more than one value should rather have more t

use the loop for to produce [-1 -1 -1 -1; 0 -1 -1 -1; 0 0 -1 -1; 0 0 0 -1]


Command Window: To the left of the Command Window, there are 2 tabs for the Current Directory Window and Workspace Window. If the Current Directory tab is selected, the files

how can i write a programm about maze solver expert system only with if & then

Passing Multiple Arguments: In many situaion it is essential to pass more than one argument to the function. For illustration, the volume of a cone is given by here r

Illustration  of assignment statements: At that point, if the expression mynum 3 is entered, the default variable ans is used as the result of this expression is not assigned