title function prints to command window instead of adding figure title
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Akzeptierte Antwort
Jan
am 22 Mär. 2017
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Title finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!