After creating the following vector, t, which of the following syntaxes will result in an error? Select all that apply.
t = [10 15 20 25 30 35];
The Options are
t([1 4:5 6])
t([1 6 4])
t([1 .5 4])
t(10) = 13
t(2:4)
t(2 3 4)
Solved Answer:
In Matlab
t = [10 15 20 25 30 35];
t([1 4:5 6])
ans =
10 25 30 35
t([1 6 4])
ans =
10 35 25
t([1 .5 4])
Array indices must be positive integers or logical values.
t(10) = 13
t =
10 15 20 25 30 35 0 0 0 13
t(2:4)
ans =
15 20 25
t(2 3 4)
t(2 3 4)
↑
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
↑
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
No comments:
Post a Comment