필터 지우기
필터 지우기

setdiff error in some cases

조회 수: 4 (최근 30일)
Neesha
Neesha 2014년 9월 26일
편집: Neesha 2014년 10월 2일
Hi I am using setdiff in my code and i am getting 'Improper assignment with rectangular empty matrix' error in a particular case , why and how to solve this? my code is as below:
A = dataset();
A.Location = {'south'};
A.Number = 3;
B= dataset();
B.Location = {'north'};
B.Number = 3;
diff1 = setdiff(A, B); %THIS EXECUTES JUST FINE
C= dataset();
C.Location = {'north'};
C.Number = 3;
C(1, :) = [];
D= dataset();
D.Location = {'west'};
D.Number = 5;
D.Location(2, 1) = {'north'};
diff2 = setdiff(C, D); %THIS EXECUTES JUST FINE
diff3 = setdiff(C, B); %THIS GIVES ME ERROR MENTIONED ABOVE, WHY?
  댓글 수: 5
Neesha
Neesha 2014년 10월 1일
Stephen Cobeldick : Yes I have, and that is how i came up with example here with the code.
per isakson : just trying to delete a row, to end up with one row in the dataset
dpb : I am not sure what you meant by 'element' but i think you are describing the problem correctly that setdiff fails when one is empty and not-empty has one row. it does work though with empty dataset if non-empty ha more than one row. What is TMW?
dpb
dpb 2014년 10월 1일
...What is TMW?...
The Mathworks, vendors of Matlab. Shorthand for the suggestion you contact official support at www.mathworks.com with a support request for an official interpretation of the behavior observed if you think it's important that the null input case not fail.

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

채택된 답변

Peter Perkins
Peter Perkins 2014년 10월 2일
Neesha, this appears to be a bug when one of the datasets has zero rows and the other has exactly one. A valid edge case to be sure, but somewhat obscure. I will make a note to adress this bug.
  댓글 수: 1
Neesha
Neesha 2014년 10월 2일
편집: Neesha 2014년 10월 2일
Thanks, i have contacted technical support and submitted this.
ref:_00Di0Ha1u._500i0DabIS:ref

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

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by