Labels and prompts, MATLAB in Mathematics

Labels and Prompts:

The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a variable exper_no, rest of the vector in a variable data (the rest being from the next element to the end). It then plots the data, by using sprintf to generate the title which includes the experiment number as shown in the figure.

438_Labels and Prompts1.png

 

The other way of completing this (in script or function) would be as shown:

fprintf('%s, Enter your id #: ',username);

id_no = input('');

 

Note that the calls to the sprintf and fprintf functions are similar except that the fprintf prints (therefore there is no requirement for a prompt in the input function) while the sprintf generates a string which can then be exhibited by the input function. In this situation by using sprintf it seems clearer than using the fprintf and then having an empty string for the prompt in input.

 

Posted Date: 10/20/2012 5:19:48 AM | Location : United States







Related Discussions:- Labels and prompts, Assignment Help, Ask Question on Labels and prompts, Get Answer, Expert's Help, Labels and prompts Discussions

Write discussion on Labels and prompts
Your posts are moderated
Related Questions
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

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt

Illustration of Variance For illustration, for the vector [4, 6, 1, 5], there are n = 4 values therefore n - 1 is 3. The mean of this data set is also 4. The variance will be

Structure Consisting of the Fields A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of th

Plot types: Besides plot and bar, there are another plot types like stem plots, histograms, stem plots, area plots and pie charts, and also other functions which customize the

Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

Common form of the switch statement: The common form of the switch statement is as shown below:   switch switch_expression   case caseexp1    action1   case cas

Example of Logical built-in functions: For equivalent to all the function, we should make sure that the entire elements in the vector are logically true. The one way of doing