How to check if a json file is empty or not in matlab?

조회 수: 2 (최근 30일)
Naresh  R A
Naresh R A 2018년 12월 11일
댓글: KSSV 2018년 12월 11일
I am reading the json file using jsondecode function.
i need to check if the json file is empty or not. If empty, display error message.

답변 (2개)

madhan ravi
madhan ravi 2018년 12월 11일

KSSV
KSSV 2018년 12월 11일
s = jsondecode('["one", "two", "three"]')
if any(cellfun(@isempty,s))
disp('empty')
else
disp('not empty')
end
  댓글 수: 7
KSSV
KSSV 2018년 12월 11일
get the file info and get it size else..
KSSV
KSSV 2018년 12월 11일
f = dir(filename) ;
f.bytes

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

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by