필터 지우기
필터 지우기

Error using title of plot

조회 수: 2 (최근 30일)
Meva
Meva 2015년 4월 6일
댓글: Meva 2015년 4월 6일
Hi,
I want to use plot with title command. But when I try title of :
title(['Plots of ... with beta1=',num2str(beta1)','alphabar=',num2str(alphabar)]);
it gives me error saying :
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
But without
beta1=',num2str(beta1)','alphabar=',num2str(alphabar)])
it is working. So beta1 and alphabar should be indicated somewhere in figure but how?

채택된 답변

Mahdiyar
Mahdiyar 2015년 4월 6일
Hi Meva
Can you send the values of "beta1" and "alphabar"?
The problem is about the dimention of "beta1" or "alphabar". One of them is a column vector.
Please check the value of these two variables.
Regards,
  댓글 수: 7
Mahdiyar
Mahdiyar 2015년 4월 6일
the point is that you put one " ' " extera. that is all.
Meva
Meva 2015년 4월 6일
thank you that solved the problem.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 4월 6일
That's why I prefer to use sprintf() instead of [ ].
caption = sprintf('Plots of ... with beta1=%f, alphabar=%f', beta1, alphabar);
title(caption, 'FontSize', 25);
  댓글 수: 3
Image Analyst
Image Analyst 2015년 4월 6일
What happens if you take off the semicolon? It should definitely define it:
caption = sprintf('Plots of ... with beta1=%f, alphabar=%f', beta1, alphabar)
The only way for caption to not be defined is if it completely skipped the line. But if it skipped that line, it wouldn't have executed the title() line either. Makes no sense.
Meva
Meva 2015년 4월 6일
I took off the semicolon but it says the same thing. Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by