フィルターのクリア

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.
  1 件のコメント
Erik J
Erik J 2017 年 2 月 21 日
Perfect. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by