How to plot a NxM matrix all in one figure using a for loop where xscale should be log

1 回表示 (過去 30 日間)
Azar Alizadeh
Azar Alizadeh 2020 年 10 月 1 日
コメント済み: Azar Alizadeh 2020 年 10 月 1 日
Hello,
I have a two NxM matrix A& B than am going to plot them all in one grap using a for loop. The xscale should be logaritmic.
My Code is as follow.
for i=1:M
figure (1)
hold on
labels={'5','6','7','8','9','10','11','12'};
ax=plot(A(:,i),B(:,i) ,'-*','LineWidth', 2);
set(ax,'xscale','log')
text((Computational_Complexity(:,i)),Train_error(:,i),labels,'VerticalAlignment','bottom','HorizontalAlignment','left')
box on;
title(' subset size')
ylabel(' Error') ;
xlabel('Complexity') ;
xlim([0 c2]);
ylim([a1 a2]);
xticks(0:10^9:c2)
xtickangle(90)
legend('')
end
but I get error :
The error is :
Error using
matlab.graphics.chart.primitive.Line/set
Unrecognized property xscale for class
Line.
Error in plot2 (line 34)
set(ax(i,:),'xscale','log')
would you please help me.
Thank you so much.

回答 (1 件)

BOB MATHEW SYJI
BOB MATHEW SYJI 2020 年 10 月 1 日
Its XScale not xscale
  1 件のコメント
Azar Alizadeh
Azar Alizadeh 2020 年 10 月 1 日
Thanks BOB, I check that one before and again now, the same error.
Error using
matlab.graphics.chart.primitive.Line/set
Unrecognized property XScale for class Line.
Error in plot2 (line 34)
set(AX(i,:),'XScale','log')
.
Actually in first iteration it plots so for i=1 it works, but in second iteration the error pops up

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

カテゴリ

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