Type logical , MATLAB Programming

Type logical:

The type logical is used to store the true/false values.

If any variables have been formed in the Command Window, they can be seen at the Workspace Window. In that window, for each variable, the variable name, value, and class (that is necessarily its type) can be seen. The other attributes of variables can also be seen in the Workspace Window. Which attributes are seen by default based on the version of MATLAB. Though, when the Workspace Window is selected, clicking View allows the user to choose which attributes will be displayed.

By default, numbers are stored as type double in the MATLAB. There are, though, many functions which convert values from one type to other. The names of these functions are similar as the names of the types merely shown. They can be used as functions to convert the value to that type. This is termed as casting the value to a different type, or type casting. For illustration, to convert a value from the type double, that is the default, to the type int32, the int32 function would be used. Typing the assignment statement which is as shown below:

>> val = 6+3

would result in the number 9 being stored in the variable val, with the default type of double, that can be seen in the Workspace Window. Afterward, the assignment statement

>> val = int32(val);

would change the type of the variable to int32, but would not change its value. If we rather stored the result in another variable, we could see the distinction in the types by using whose.

>> val = 6 + 3;

>> vali = int32(val);

>> whos

Name Size Bytes Class Attributes

val 1x1 8 double

vali 1x1 4 int32

One of the reasons for using an integer type for a variable is to save the space.

Posted Date: 10/18/2012 4:02:24 AM | Location : United States







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

Write discussion on Type logical
Your posts are moderated
Related Questions
There are many approaches to numerically estimating the derivative of the function.  The relationship:   is called a forward difference, since the estimate of the derivativ

Problem 1:   What are the different methods that can be used to solve a differential equation? Please provide a numbered list. Problem 2:   For a first order linear d

For the 66kV subtransmission network shown below, calculate the following, using a MATLAB Simulink Power System Blockset model: 1. Three phase, phase-to-phase and phase-to-earth

A three degree of freedom system is shown in Figure.  The three masses are each 1 kg and are constrained to move in the directions shown.   The three stiffnesses are   5 kN/m, 50 k

i need help with a monte carlo simulation. I have most of the code, but I can''t get it to plot correctly

Input in a for Loop: The script below repeats the process of prompting the user for a number, and echo printing the number (that means simply printing it back out). A for loop

Matlab Command Reference 1. Getting Help: The help command is used to find the functions and its syntax. Similarly, lookfor is used to find the functions or topics. For examp

I need assignment to finish.

Using numerical techniques, plot the intensity distribution for LP 01 and LP 11 modes. Vary the value of V (reduce it to 1.5) and plot several of the intensity plots (of LP 01 )

Example of Variables and assignment statements: The expression is computed and then that value is stored in the variable. For illustration, this is the way it would appear in