필터 지우기
필터 지우기

Error using title (line 21) Incorrect number of input arguments

조회 수: 5 (최근 30일)
Hi I am trying to title my subplots but somehow it is not working.
ax(1) = subplot(1,3,1) %Thorax Joint
for n = 1:10
ax(1)=plot(SF.T{n,1}(:,1),'g'); %right side trials
hold on
end
for n = 1:10
ax(1)=plot(SF.T{n,2}(:,1),'b'); %left side trials
hold on
end
title(ax(1),'Thorax')
This is the error I am getting:
Error using title (line 21)
Incorrect number of input arguments
If I try title('Thorax') then it is working, but if I add the other subplots, then it only gives me the title to the last subplot.

채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 5월 13일
The syntax o f function title is
title(obj,txt)
where variable obj must be an axes object or a legend object, but in your code, you are trying to put the output of the plot command (which are chart line objects).
Then, a solution is:
ax(1) = subplot(1,3,1) %Thorax Joint
for n = 1:10
plot(SF.T{n,1}(:,1),'g'); %right side trials
hold on
end
for n = 1:10
plot(SF.T{n,2}(:,1),'b'); %left side trials
hold on
end
title(ax(1),'Thorax')

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by