Error using text() function: "Subscript indices must either be real positive integers or logicals."
Mostrar comentarios más antiguos
Hi,
I am plotting a tree using treeplot() and I would like to put some text on the nodes with the treelayout() and text() functions. I get the error when trying to plot the text on the current figure.
This is the code:
t=[0,1,1,2,2] ; [x,y]=treelayout(t) ; treeplot(t) ; text(x(1),y(1),'root')
And this is the error I get:
Subscript indices must either be real positive integers or logicals.
I have tried it with additional parameters without success and I get the same error when using the text() function in any other context. For instances:
figure ; hold on ; plot(rand(1,10),rand(1,10),'ro') ; text(0.5,0.5,'center')
I am using MATLAB 8.2.0.701 (R2013b) for Ubuntu, but I have tried it on the Windows version and I got the same error.
Any suggestion?!
1 comentario
dpb
el 1 de Mayo de 2014
You've apparently accidentally aliased text w/ a variable it would appear.
To confirm this, try
which text
and see.
clear text
should restore things to normal.
Respuestas (1)
Jean Montiel
el 21 de Nov. de 2016
0 votos
I looked for an answer like this, thanks... I had a text variable, XD
Categorías
Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!