Can I return 'nan' value for bad data?

조회 수: 2 (최근 30일)
Atanu
Atanu 2022년 11월 14일
답변: Star Strider 2022년 11월 14일
I am writing an algorithm for a big database. I am running the algorithm in a for loop over the database trials. My algorithm works for >99% of the trials in the database. But it stops for a few due to some bad data entry. So I have to keep eye to check if my loop has stopped running. Can I force the algorithm to output 'nan' value for the cases where there are bad data? If not how should I avoid the situstion?
Here is the error message given by Matlab.
% Unable to perform assignment because the left and right sides have a different number of elements.

답변 (1개)

Star Strider
Star Strider 2022년 11월 14일
One option would be to create the left side as a cell array (so the dimensions do not have to match) and then deal with any inconsistencies when that part of the code (apparently the loop) finishes.

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by