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
Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Illustration of Advanced file input and output: For illustration, to refer to the third number in the first element of the cell array: >> subjdata{1}(3) ans =

Nested IF-ELSE statements: The if-else statement is used to select between the two statements. In order to select from more than two statements, the if-else statements can als

how can reconstruct just part of an image using imreconstruct?

Illustration of Standard Deviation The less spread out the numbers are, therefore smaller the standard deviation will be, as it is a way of determining the spread of the data.

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

This project requires you to use the ideas of Chapter 25 regarding maximization of a function. Here we assume that evolution has acted to generate highly efficient foragers. By hig

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

fprintf function - File function: The fprintf function really returns the number of bytes which was written to the file, therefore if you do not want to see that number, suppr

Plot Functions: Faraway, we have plotted to generate two-dimensional plots and bar to generate bar charts. We have seen how to clear the Figure Window by using clf, and how to