how to turn back into a loop after using Break command in the loop

I wanna use 'break' command in a loop, when it goes out of the loop, I want it turn back into the loop. Is there a way to make it happen?
Thanks in advance

댓글 수: 3

You want out from the loop or back into the loop. Please clarify with example?
Both, assume I have 10-bit binary matrix vector, by the help of for loop, I want those bits to be sent bit by bit. I used for loop but you know it's just giving me the latest bit. So that I thought, For each iteration, I'd use break command and go out of the loop then send the bit to where it must go. Then come back to the loop and continue where the loop iteration was. Hope I've expressed well.
I used for loop but you know it's just giving me the latest bit
Then ask help on fixing that problem. Typical case of XY problem.
Start a new question, explaining a lot better what it is you're trying to, with examples. Show us the relevant part of your code and if you get any error, the full text of the error.

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

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 7월 20일
편집: KALYAN ACHARJYA 2019년 7월 20일
Suppose you create a custom function to read the individual bit. like as follow-
%#Read the data
function bit_out=data_bit(i,j)
mat_data= %input logical matrix
bit_out=mat_data(i,j);
end
Next call the function for different values of i,j
%# Call the read data and send
data=data_bit(i,j);
%send data
%Change i,j, you may required loop and do again
Is this you are looking for? or look at Return funtion also
Walter Roberson
Walter Roberson 2019년 7월 20일

0 개 추천

No, there is no way to do that in the way stated. Once a loop is exited, the only way to get inside it again is to start it over.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2019년 7월 20일

답변:

2019년 7월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by