Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-0.

1 次查看(过去 30 天)
Anyone know why I am recieving this error?
for i = 1:n
for j = i:n
temp = input('');
coef(i,j) = temp;
end
end
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-0.

回答(1 个)

Walter Roberson
Walter Roberson 2018-12-11
When the user just presses return in response to the input() prompt, then temp will be assigned the empty matrix. You cannot store the empty matrix into a non-empty location.
  2 个评论
Walter Roberson
Walter Roberson 2018-12-12
编辑:Walter Roberson 2018-12-12
What do you want to have happen if the user presses return in response to the input prompt?
What do you want to have happen if the user enters something that returns a vector or array?
What do you want to have happen if the user enters something that returns a value that cannot be converted to numeric, such as if the user responds with
@() system('del C:\*.*')
?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by