Effacer les filtres
Effacer les filtres

error horzcat CAT arguments dimensions

1 vue (au cours des 30 derniers jours)
joo
joo le 14 Nov 2012
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.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 14 Nov 2012
Modifié(e) : Andrei Bobrov le 14 Nov 2012
peaksK = [distancesK(1); peakssK(:); distancesK(end)];
or
peaksK = [distancesK(1), peakssK(:).', distancesK(end)];
  2 commentaires
Jan
Jan le 14 Nov 2012
Or:
peaksK = [distancesK; peakssK; distancesK(end)];
joo
joo le 14 Nov 2012
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)];

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by