Wanted to check if a variable exits or not within 'nirsinfo'.
2 次查看(过去 30 天)
显示 更早的评论
if exist(nirsInfo.RawDataInfo.checking,'var') == 1
disp("file exists");
else
disp("doesnt");
end
Here since the .checking doesn't exsist it throwing Reference to non-existent field 'checking' error.
回答(1 个)
Sahithi Kanumarlapudi
2019-11-4
‘isfield' can be used to check if a field exists within a structure.
Refer to the following documentation for more information on ‘isfield’
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!