How to skip an empty value

조회 수: 50 (최근 30일)
Eliska Paulikova
Eliska Paulikova 2023년 2월 27일
댓글: Fangjun Jiang 2023년 2월 28일
Hello I work with this data in my program, but if there are empty spots, the program stops itself. I would like to now, how can I say to matlab to ignore these empty values or fill it with the previous value. Thank you so much

채택된 답변

Fangjun Jiang
Fangjun Jiang 2023년 2월 27일
You can use isempty(rp) to check, and then ignore as needed.
  댓글 수: 9
Eliska Paulikova
Eliska Paulikova 2023년 2월 28일
Thank you so much
Fangjun Jiang
Fangjun Jiang 2023년 2월 28일
In the code, you have this line "rp=radiiBright %v pixelech". It does not have the ";" at the end of line so every time "rp" got calculated, it displays at the Command Window as you showed.
You can add this right after to "skip".
if isempty(rp)
continue
end
The "continue" command will jump the execution to the end of the current loop and start executing the next loop.
This might help you avoid the problem at line
"r=fillmissing(rp + 0./(rp~=0), 'linear', 1)".
But it might also cause problem somewhere else.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by