insufficient number of outputs from right hand side of equal sign to satisfy assignment. in matlab

This error occurs when the number of output variables on the left-hand side of the equal sign does not match the number of outputs generated on the right-hand side of the equal sign during variable assignment.

To resolve this, make sure the number of output variables on the left-hand side of the equal sign matches the number of generated variables on the right-hand side of the equal sign.

Example:

main.m
a = [1,2,3];
[b,c] = size(a); % Error, b and c expect to receive one output, but size() returns two outputs
108 chars
3 lines

To fix the error mentioned in the example above, you can simply change the line to:

main.m
[b,c] = size(a);
17 chars
2 lines

related categories

gistlibby LogSnag