Blanks function, MATLAB in Mathematics

Blanks function:

The blanks function will generate a string consisting of n blank characters-that are kind of hard to see here! Though, in a MATLAB if the mouse is moved to highlight the answer in ans, the blanks can be seen.

>> blanks(4)

ans =

>> length(ans)

ans =

4

 

Generally this function is most helpful when concatenating strings and you want a number of blank spaces in between. For illustration, this will insert five blank spaces in between the words:

 

>> [first blanks(5) last]

ans =

Bird     house

 

Showing the transpose of the blanks function can also be used to move the cursor down. In the Command Window, it would appear like this:

>> disp(blanks(4)')

>> 

This is helpful in a script or function to generate space in output, and is basically equivalent to printing the newline character four times.

Posted Date: 10/20/2012 5:07:28 AM | Location : United States







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

Write discussion on Blanks function
Your posts are moderated
Related Questions
Illustration of nested function: The output arguments are distinct from variables. The scope of an output argument is merely the nested function; and it cannot be used in the

Blanks function: The blanks function will generate a string consisting of n blank characters-that are kind of hard to see here! Though, in a MATLAB if the mouse is moved to hi

Concatenation: The String concatenation means to join the strings altogether. Of course, as strings are merely vectors of the characters, the technique of concatenating vector

Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Minimum and Maximum Value The MATLAB has built-in functions for numerous statistics. For illustration, min and max to find the minimum or maximum value in a data set. >> x

User input in the while loop: Here is an illustration of running this script: >> readonenum Enter a positive number: -5 Invalid! Enter a positive number: -2.2

Complex numbers: A complex number is commonly written in the form z = a + bi here a is known as the real part of the number z, b be the imaginary part of z, and i is √-1

Logical Vectors: The relational operators can also be used with the vectors and matrices. For illustration, let's say that there is a vector, and we want to compare each eleme

Error-checking for integers: illustrations of running this script as shown below: >> readoneint Enter an integer: 9.5 Invalid! Enter an integer: 3.6 Invalid

Illustration of Logical vectors: Calling the function appears to return similar vector as simply vec > 5, and summing the result still works to determine how many elements wer