Continue with script despite an absent variable (error)?
古いコメントを表示
Hello, so I have a script that analyzes several variables on a truck (such as engine speed, GPS coordinates, etc.), and it makes sure the variables are within a certain range and that they exist. One of our variables, DPF temperature, is often absent, and I am wondering if there is a way to continue running my script even though Matlab shows an error saying the DPF temp variable does not exist? Here is the DPF temp code...
if exist('CAN2_THMM_03158_MSG0_DPF_INLET')==0; %#ok<EXIST>
disp('--An error has occurred in "CAN2_THMM_03158_MSG0_DPF_INLET" - Data does not exist.');
else
x = min(CAN2_THMM_03158_MSG0_DPF_INLET);
y = max(CAN2_THMM_03158_MSG0_DPF_INLET);
if any( y > 800 | x < -25)
disp('--An error has occurred in "CAN2_THMM_03158_MSG0_DPF_INLET" - Data outside accepted range.');
end
Matlab will recognize that 'CAN2_THMM_03158_MSG0_DPF_INLET' does not exist, and it will show an error and stop the entire script. How do I prevent this?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Scope Variables and Generate Names についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!