필터 지우기
필터 지우기

Cell contents reference from a non-cell array object.

조회 수: 2 (최근 30일)
Mira le
Mira le 2019년 11월 16일
편집: Guillaume 2019년 11월 17일
Error in Evaluation (line 67)
U = [U TI(1).Si{a}];
here is my code, how can i fix this error?
T1 = Evaluation( pop,SI,D,N,m,T1,MST,NS)
chr.id=[];
chr.sequence=[];
chr.Si={};
chr.relevant=[];
chr.vic_item = [];
TI=repmat(chr,numel(N/2));
U =[];
for a=1:numel(TI(1).Si)
U = [U TI(1).Si{a}];
end
U = unique(U,'first');
U;
  댓글 수: 5
Mira le
Mira le 2019년 11월 17일
편집: Mira le 2019년 11월 17일
Is there another method to replace this U = [U TI(1).Si{a}]; ?
Guillaume
Guillaume 2019년 11월 17일
편집: Guillaume 2019년 11월 17일
You need to pay attention to the comments you were given. It's very difficult to help you when you provide code that has no comment and doesn't work.
As Walter explained, numel(N/2) is always the same as numel(N). The actual values of N don't matter to know how many elements there are, so dividing the values by 2 doesn't change their count. If N is scalar, whether it's 10, 1 million or 0, numel(N) is 1. so your
T1 = repmat(chr,numel(N/2));
doesn't do anything useful, it's simply
T1 = chr;
As the cyclist explained, with the given code T1.Si (which is chr.Si) is an empty cell array, so numel(T1.Si) is 0 and the loop
for a=1:numel(TI(1).Si)
doesn't even execute once. So the code you've shown cannot produce your error.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by