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

 채택된 답변

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

댓글 수: 5

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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

2024년 2월 6일

댓글:

2024년 2월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by