Wanted to check if a variable exits or not within 'nirsinfo'.
Show older comments
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 Comment
CalebJones
on 22 Oct 2019
Edited: CalebJones
on 22 Oct 2019
Answers (1)
Sahithi Kanumarlapudi
on 4 Nov 2019
0 votes
‘isfield' can be used to check if a field exists within a structure.
Refer to the following documentation for more information on ‘isfield’
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!