필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Error using horzcat: Dimensions of matrices being concatenated are not consistent.

조회 수: 1 (최근 30일)
Siti Suhaila
Siti Suhaila 2018년 1월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello everyone, here is the partial code that creates above error:
counter=1;
accessRow=0;
for r=1:length(m)
accessVector=m(r);
newAccessVector=cell2mat(accessVector);
accessRow=accessRow + newAccessVector;
SplitFeaturesRow{r}=cidxE(counter:accessRow)
counter=1+accessRow;
vocabsize=1:500;
freq{r}=histc(SplitFeaturesRow{r},vocabsize);
combineFreq=horzcat(freq{:});
end
Referring code above, m output= 474 X1 cell but r output = 472 . I wonder why r did not get 474 as it should follow the length of m. I think this is the reason why I got that error message. But how to correct r?
  댓글 수: 3
Walter Roberson
Walter Roberson 2018년 1월 18일
Okay... but are you sure you want to do that horzcat() within the loop? Every iteration of the loop you are overwriting the complete combineFreq variable

답변 (1개)

KSSV
KSSV 2018년 1월 18일
Try:
out = cat(1, freq{:})
  댓글 수: 1
Siti Suhaila
Siti Suhaila 2018년 1월 18일
Error using cat Dimensions of matrices being concatenated are not consistent.
Error in (line 69) combineFreq = cat(1, freq{:});

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by