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
i am doing my project on matlab and the topic of my project is invisible watermarking.How we can extract all pixel values of image in binary form.

Design and implement Binary digital modulation for a specific input signal frequency, sampling frequency and signal level for binary frequency shift keying (BFSK) by applying MATLA

Problem 1. Create a vector representing x coordinates of a measurement with 20 points between 0 and 10. Create another vector y representing fake measurements which are related to

Use Matlab to solve the following set of linear equations by Gaussian Elimination. Write a for loop to perform elementary row operations on the augmented matrix to produce

How to make EMG analysis by Matlab?

1;write a matlab of geuss elimination with scaling and pivoting under consideration?

my project is on load frequency control using FPID tuned using GA and PSO algorithm.the system is a two area system.

need help with while and loops

I have couple questions in MATLAB I need help in

I want to know how to create a numerical solution code for analysing temperature/isotherms on a 2d square plate with a singular heat source and opposing edges being held at constan