Undefined function 'eq' for input arguments of type 'struct'

조회 수: 10 (최근 30일)
pamela sulis
pamela sulis 2015년 10월 27일
편집: pamela sulis 2015년 10월 28일
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
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.
pamela sulis
pamela sulis 2015년 10월 28일
편집: pamela sulis 2015년 10월 28일
yes, i want to test if the structure is empty... I try if(isempty(s)) instead of if(s(1,1)==[]) and i solve my problem! Thanks

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

채택된 답변

James Tursa
James Tursa 2015년 10월 27일
Does this do what you want?
if( isempty(s) )
  댓글 수: 3
James Tursa
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.
pamela sulis
pamela sulis 2015년 10월 28일
I use if( isempty(s) ) and i solve the problem! Thanks

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by