error in variables statementserror the expression


Error in variables statements:

Error: The expression in the left of equals sign is not a valid target for an assignment.

>> 

By placing a semicolon at the end of the statement suppress the output. For illustration,

>> res = 9 - 2;

>> 

This would assign the result of the expression on the right side, the value 7, to the variable res; it merely doesn't show that result. Rather than, the other prompt appears instantly. Though, at this point in the Workspace Window the variables mynum and res can be seen.

The spaces in an expression or statement do not influence the result, but make it easier to read. The below statement that has no spaces would accomplish exactly the similar thing as the earlier statement:

>> res = 9-2;

The MATLAB uses a default variable named 'ans' if an expression is typed at the prompt and it is not assigned to a variable. For illustration, the result of the expression 6 + 3 is stored in the variable ans:

>> 6 + 3

ans =

9

This default variable is reused any time merely an expression is typed at the prompt. A short cut for retyping a command is to press the up-arrow ↑, which will go back to the formerly typed command. For illustration, if you decided to assign the result of the expression 6+3 to the variable res rather than of using the default ans, you can press the up-arrow and then the left-arrow to change the command rather than retyping the entire statement:

>> res = 6 + 3

res = 9

 

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: error in variables statementserror the expression
Reference No:- TGS0174692

Expected delivery within 24 Hours