Search found 3900 matches

by matlab1
Wed Aug 26, 2020 3:40 am
Forum: Basic
Topic: Attempted to access A(-1); index must be a positive integer or logical.
Replies: 1
Views: 909

Re: Attempted to access A(-1); index must be a positive integer or logical.

This error appears, when the index of an array is negative and as you know, the index of a matrix can not be negative or zero in MATLAB.

The index of matrix must be bigger than zero and muse be an integer

by matlab1
Wed Aug 26, 2020 3:38 am
Forum: Basic
Topic: The expression to the left of the equals sign is not a valid target for an assignment.
Replies: 1
Views: 938

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

This error happens in MATLAB, when the left side of an equation or command can not save the result of a command. for example : sum2 = 10 in3 = [2,3] if( y = in3 ) sum_y = sum2 +1; end In the top m-file, there is error in the if-command. The in3 variable is a matrix, but the y variable is a number, ...
by matlab1
Tue Aug 25, 2020 11:40 am
Forum: Basic
Topic: Unbalanced or misused parentheses or brackets.
Replies: 2
Views: 1091

Re: Unbalanced or misused parentheses or brackets.

The solution is described in the

https://matlab1.com/forum/viewtopic.php?f=22&t=19
by matlab1
Tue Aug 25, 2020 11:40 am
Forum: Basic
Topic: Unbalanced or misused parentheses or brackets.
Replies: 2
Views: 1091

Re: Unbalanced or misused parentheses or brackets.

The solution is described in the

https://matlab1.com/forum/viewtopic.php?f=22&t=19
by matlab1
Tue Aug 25, 2020 11:38 am
Forum: Basic
Topic: Expression or statement is incorrect--possibly unbalanced (, {, or [.
Replies: 1
Views: 932

Re: Expression or statement is incorrect--possibly unbalanced (, {, or [.

AS you know, when a thing is unbalanced that there is no same character in both side.

for example :

A = [3,4; 6 7

or

out = sum((x-y)+90

In both statements, there is no same symbol at the end of the statement.

Correct expression :



A = [3,4; 6 7]

or

out = sum((x-y)+90)



:P
by matlab1
Tue Aug 25, 2020 11:34 am
Forum: Basic
Topic: A MATLAB string constant is not terminated properly
Replies: 1
Views: 870

Re: A MATLAB string constant is not terminated properly

For solution, you must enter a complete string

for example

var1 = "matlab1.com


is wrong, because you did not terminate the string.

var1 = "matlab1.com"


is right.
by matlab1
Tue Aug 25, 2020 11:30 am
Forum: Basic
Topic: The input character is not valid in MATLAB statements or expressions
Replies: 1
Views: 1054

Re: The input character is not valid in MATLAB statements or expressions

This error in MATLAB, shows that you use an invalid character in the statement or expression

for example

plot("sd")

The plot command, does not accept string as first input.
by matlab1
Tue Aug 25, 2020 11:25 am
Forum: Basic
Topic: Not enough input arguments
Replies: 1
Views: 867

Re: Not enough input arguments

This error is very clear,

When you call a function in MATLAB, but you do not enter the required number of inputs, you will see this error message.

For example :

function n = myfun(a,b)
n = a-b+50



if you call the top function as follows

myfun(77)

You will face this error.
by matlab1
Wed Aug 19, 2020 1:11 pm
Forum: datatypes
Topic: Format type must be %f, %F, %g, %G, %e, %E, %d or %i
Replies: 1
Views: 523

Re: Format type must be %f, %F, %g, %G, %e, %E, %d or %i

You can just use %f, %F, %g, %G, %e, %E, %d or %i
for
format tye.

by matlab1
Wed Aug 19, 2020 12:34 pm
Forum: datatypes
Topic: Specified character vector is an invalid color value
Replies: 1
Views: 524

Re: Specified character vector is an invalid color value


example :

% Convert color code to 1-by-3 RGB array (0~1 each)
str = '#FF0000';


color = sscanf(str(2:end),'%2x%2x%2x',[1 3])/255;