Clear Filters
Clear Filters

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.

4 views (last 30 days)
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.

Answers (1)

Walter Roberson
Walter Roberson on 11 Dec 2018
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 Comments
Walter Roberson
Walter Roberson on 12 Dec 2018
Edited: Walter Roberson on 12 Dec 2018
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:\*.*')
?

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!