From: Wendy on
Hi all,

I am trying to annotate a bar plot, however I am keeping getting the error "??? Subscript indices must either be real positive integers or logicals.". The error happens even when I try the matlab example,

plot(0:pi/20:2*pi,sin(0:pi/20:2*pi))
text(pi,0,' \leftarrow sin(\pi)','FontSize',18)

Does anyone know why it happens?

Thanks a lot,
Wendy
From: us on
"Wendy " <wlq121(a)gmail.com> wrote in message <hvmfie$44h$1(a)fred.mathworks.com>...
> Hi all,
>
> I am trying to annotate a bar plot, however I am keeping getting the error "??? Subscript indices must either be real positive integers or logicals.". The error happens even when I try the matlab example,
>
> plot(0:pi/20:2*pi,sin(0:pi/20:2*pi))
> text(pi,0,' \leftarrow sin(\pi)','FontSize',18)
>
> Does anyone know why it happens?
>
> Thanks a lot,
> Wendy

most likely, you (inadvertently) created a var TEXT along the way...
do this

which text -all;
% then
clear text;
which text -all;
% then, run your code, again (which, by the way, works fine here)...

% see this FEX submission to check for the validity of your vars...

http://www.mathworks.com/matlabcentral/fileexchange/27797-cvar-a-pedestrian-variable-name-checker

us
From: TideMan on
On Jun 21, 1:47 pm, "us " <u...(a)neurol.unizh.ch> wrote:
> "Wendy " <wlq...(a)gmail.com> wrote in message <hvmfie$44...(a)fred.mathworks..com>...
> > Hi all,
>
> > I am trying to annotate a bar plot, however I am keeping getting the error "??? Subscript indices must either be real positive integers or logicals.". The error happens even when I try the matlab example,
>
> > plot(0:pi/20:2*pi,sin(0:pi/20:2*pi))
> > text(pi,0,' \leftarrow sin(\pi)','FontSize',18)
>
> > Does anyone know why it happens?
>
> > Thanks a lot,
> > Wendy
>
> most likely, you (inadvertently) created a var TEXT along the way...
> do this
>
>      which text -all;
> % then
>      clear text;
>      which text -all;
> % then, run your code, again (which, by the way, works fine here)...
>
> % see this FEX submission to check for the validity of your vars...
>
> http://www.mathworks.com/matlabcentral/fileexchange/27797-cvar-a-pede...
>
> us

How can you tell, us, that her transgression is not with sin?