Undefined function 'eq' for input arguments of type 'struct'
6 次查看(过去 30 天)
显示 更早的评论
Hi! I create this code in which s is a struct
if(s(1,1)==[])
i=i+1;
end
I have an error: 'Undefined function 'eq' for input arguments of type 'struct', I don't understand the error's meaning. Someone can help me, thanks
2 个评论
Stephen23
2015-10-27
Do you want to test if the structure is empty?
If s is a structure, then s(1,1) will also be a structure, which clearly is not a number and so does not make sense to check if it equals something else.
采纳的回答
James Tursa
2015-10-27
Does this do what you want?
if( isempty(s) )
3 个评论
James Tursa
2015-10-27
编辑:James Tursa
2015-10-27
I know. It is for readability ... at least to my eyes. Could be as you surmise, because it looks more like C or Fortran, so my brain doesn't have to think as much in determining what is on the line.
更多回答(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!