title function prints to command window instead of adding figure title
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Risposta accettata
Jan
il 22 Mar 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Title in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!