repmat function give error

조회 수: 3 (최근 30일)
emna massoudi
emna massoudi 2014년 12월 31일
댓글: emna massoudi 2014년 12월 31일
can anyone help me please, when i run this line of code give me the following eroor :
Error using repmat Replication factors must be a row vector of integers or integer scalars.
Error in cvGaborTextureSegmentRun (line 28) imseg(idx, :) = repmat(color(i, :), [], length(idx));

채택된 답변

Matt J
Matt J 2014년 12월 31일
편집: Matt J 2014년 12월 31일
Are you sure it's repmat that you want? The calling syntax looks like you were trying to use reshape() instead. If you're sure repmat was intended, then this might be what you were trying to do,
imseg(idx, :) = repmat(color(i, :), [length(idx),1]);
  댓글 수: 1
emna massoudi
emna massoudi 2014년 12월 31일
thank you so much Matt J it's work well to imseg(idx, :) = repmat(color(i, :), [length(idx),1]); :)

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

추가 답변 (1개)

Stephen23
Stephen23 2014년 12월 31일
편집: Stephen23 2014년 12월 31일
The behavior of repmat might be a little different between versions, but according to both the online and program documentation it is not defined for an empty matrix as an input. What would you expect the value of [] * size(X,1) to be? If you are trying to use the empty matrix as a placeholder (i.e. to not replicate the matrix in this dimension), then instead just put the value one 1 in that position.
The error message is telling you that your empty input values is not allowed, and that the input must be either two scalar integers, or a vector of integers, as the documentation states.
Or perhaps you really intended to use reshape , which does allow any empty matrix as a placeholder for the size of one dimension?
  댓글 수: 1
emna massoudi
emna massoudi 2014년 12월 31일
thank you so mutch Stephen Cobeldick it's ok with imseg(idx, :) = repmat(color(i, :), [length(idx),1]); and works well

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by