Illustration of variable scope, MATLAB in Engineering

Illustration of Variable scope:

Running this function does not add any of variables to the workspace, as elaborated:

>> clear

>> who

>> disp(mysum([5 9 1]))

   15

>> who

>> 

The variables that are also defined in the Command Window cannot be used in a function.

Though, scripts (as opposite to the functions) do interact with the variables which are defined in the Command Window. For illustration, the function is changed to be a script mysummfile.

731_Variable Scope1.png

 

Posted Date: 10/19/2012 8:59:32 AM | Location : United States







Related Discussions:- Illustration of variable scope, Assignment Help, Ask Question on Illustration of variable scope, Get Answer, Expert's Help, Illustration of variable scope Discussions

Write discussion on Illustration of variable scope
Your posts are moderated
Related Questions
Illustration of Image processing: This displays that there are 64 rows, or in another word, 64 colors, in this specific colormap. It also displays that the first five colors a

Patch function - graphics objects: The patch function is used to generate a patch graphics object, which is made from 2-dimensional polygons. The patch is defined by its verti

Example of Gauss-jordan: For a 2×2 system, this would results and for a 3 × 3 system, Note that the resulting diagonal form does not involve the right-most col

I have a 400x2 vel.dat and 20x2 xy.dat file, how can i plot a streamslice graph on matlab with this two files.



Print from the structure: To print from the structure, a disp function will show either the whole structure or a field. >> disp(package) item_no: 123 cost: 19.99

Storing Strings in Cell Arrays: The one good application of a cell array is to store strings of various lengths. As cell arrays can store various types of values in the elemen

Logical scalar values: The MATLAB also has or and and operators which work element wise for the matrices: These operators will compare any of the two vectors or matric

Algorithm for the function explaine: The algorithm for the function explaine is as shown:  Print a description of e, the exp function, and how to find the approximate va