Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element

packet_allocated_bandwidth = 0; This line of code was initially given as zero. So when I assigned 200 to packet allocated bandwidth of the next connection,it displays the error given below. NextConnection.packet_allocated_bandwidth = 200; This line of code displays the following error: Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element. Please what does it want me to do? Help is needed. Thanks in advance

 Accepted Answer

if ~isempty(NextConnection)
NextConnection.packet_allocated_bandwidth = 200;
else
...something else
end

5 Comments

Thanks for your reply sir. But what could that 'something else' will represent sir?
You're the only one with any way of knowing that. What would cause NextConnection to be empty and what would you want done in that case?
After inserting the lines of codes you suggested for me, it displays nextconnection is empty, immediately the simulation stopped. Please what should I do to make the nextconnection not to be empty?
We have no information about what NextConnection is, or the circumstances under which it is changed, so we are not able to offer any advice as how to make it not be empty.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!