필터 지우기
필터 지우기

error horzcat CAT arguments dimensions

조회 수: 1 (최근 30일)
joo
joo 2012년 11월 14일
does anyone understand why am i getting this error:
??? Error using ==> horzcat CAT arguments dimensions are not consistent. Error in ==> code at 60 peaksK = [distancesK(1), peakssK, distancesK(end)];
when using this code:
(distancesK = 582x1 double)
[peakssK, iPeakssK] = findpeaks(distancesK);
peaksK = [distancesK(1), peakssK, distancesK(end)];
i have already used this code million times but now it is giving me this error. can anyone help me please? thank you very much.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 11월 14일
편집: Andrei Bobrov 2012년 11월 14일
peaksK = [distancesK(1); peakssK(:); distancesK(end)];
or
peaksK = [distancesK(1), peakssK(:).', distancesK(end)];
  댓글 수: 2
Jan
Jan 2012년 11월 14일
Or:
peaksK = [distancesK; peakssK; distancesK(end)];
joo
joo 2012년 11월 14일
thank you so much for the both of you.it worked like this. thank you.
peaksK = [distancesK(1), peakssK.', distancesK(end)];
iPeaksK = [1, iPeakssK.', length(distancesK)];

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

추가 답변 (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