check if value ist empty in matlab

In MATLAB, we can use the isempty function to check if a value is empty or not. The function returns a logical 1(true) if input is an empty array and a logical 0(false) otherwise.

main.m
val = [] %example empty value

if isempty(val)
    disp("value is empty")
else
    disp("value is not empty")
end
114 chars
8 lines

The output would be:

main.m
value is empty
15 chars
2 lines

related categories

gistlibby LogSnag