필터 지우기
필터 지우기

Vertcat error on x-axis tick labels

조회 수: 1 (최근 30일)
Erik J
Erik J 2017년 2월 21일
댓글: Erik J 2017년 2월 21일
I cannot figure out why I keep getting the Vertcat error (Dimensions of matrices being concatenated are not consistent) when I try to set the XTickLables. The relevant code is below. Any help is much appreciated. I'm on 2014a.
[~,Ex,Cam,CF] = LoudnessModel_Chen2011(OuterEarOpt,f,lv, 0, 70, 10);
figure(1);semilogx(CF,10*log10(Ex),'r', 'linewidth',1.5);
ylim([0 120]);
xlim([0 10000]);
xx=title('SNHL', 'fontweight', 'bold','FontSize', 20);
P = get(xx,'Position');
set(xx,'Position',[P(1) P(2)+2.75 P(3)]);
xlabel('Frequency (Hz)', 'FontSize',22);
ylabel('Excitation Level (dB)', 'FontSize',22);
set(gca, 'XTick', [100 500 1000 2000 4000 8000]);
set(gca, 'XTicklabel', ['100'; '500'; '1000'; '2000'; '4000'; '8000']);
set(gca, 'FontSize', 15)
set(gca,'ticklength',2.5*get(gca,'ticklength'));

채택된 답변

Jan
Jan 2017년 2월 21일
편집: Jan 2017년 2월 21일
Use a cell string instead:
set(gca, 'XTicklabel', {'100'; '500'; '1000'; '2000'; '4000'; '8000'});
Concatenating the strings tries to create this:
['100'; ....
'500'; ...
'1000'; ...
'2000'; ...
'4000'; ...
'8000']
and as the error message says, this char matrix has a different number of columns per row.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by