title function prints to command window instead of adding figure title
조회 수: 3 (최근 30일)
이전 댓글 표시
I'm using matlab R2016b. I tried using title function but instead of adding a title to the figure it prints to the command window. I tried to use the example appears in matlab help:
plot((1:10).^2)
title('My Title')
and it printed the following instead of adding a title to the figure:
--------------------------------
My Title
--------------------------------

using the same lines in matlab R2015b added a title to the figure
댓글 수: 1
채택된 답변
Jan
2017년 3월 22일
This means, that you have added a folder on top of the path, which contains a file called "title.m". This shadows the built-in function with the same name. Solutions:
- builtin('title', 'My Title') A bad idea, because other functions of Matlab's toolboxes will suffer from the same problem
- Move the new title.m file to a subfolder called \private, then it is visible only for the functions in the parent folder.
- Rename the new file and adjust the code.
A general rul is not to add folders on top of tha path. Shadowing built-in functions leads to problems frequently, but Matlab's toolboxes have so many commands, that it is hard to avoid this consequently. At least the occurring problems get less confusing, if the folders are appended to the path.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!