필터 지우기
필터 지우기

what is the error here?

조회 수: 1 (최근 30일)
Amr Hashem
Amr Hashem 2015년 5월 15일
답변: Walter Roberson 2015년 5월 17일
data1 = [data1,(text(k,6))];
Error using horzcat CAT arguments dimensions are not consistent.
Error in data1 = [data1,(text(k,6))];
  댓글 수: 4
Amr Hashem
Amr Hashem 2015년 5월 16일
this is the contets of datatext and text
datatext 5*6 cell text 8*6 cell
i want the answer to be:
ans 5*8 cell
Amr Hashem
Amr Hashem 2015년 5월 16일
편집: per isakson 2015년 5월 16일
any help, this is the code
for Q=1:length(querymdr)
for k=1:length(text)
if datatext{Q,1}==text{k,1}
datatext = [datatext,(text(k,6))];
end
end
end

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

답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 17일
You need to find an empty position in datatext(Q,:) to assign into. For example,
nextslot = find(cellfun(@isempty,datatext(Q,:)));
if isempty(nextslot)
nextslot = size(datatext,2);
end
datatext{Q,nextslot} = text{k,6};
This will grow datatext wider if necessary in order to handle the new information.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by