Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
text annotate graphs

Subject: text annotate graphs

From: Wendy

Date: 21 Jun, 2010 01:34:06

Message: 1 of 3

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

Subject: text annotate graphs

From: us

Date: 21 Jun, 2010 01:47:06

Message: 2 of 3

"Wendy " <wlq121@gmail.com> wrote in message <hvmfie$44h$1@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

Subject: text annotate graphs

From: TideMan

Date: 21 Jun, 2010 04:41:43

Message: 3 of 3

On Jun 21, 1:47 pm, "us " <u...@neurol.unizh.ch> wrote:
> "Wendy " <wlq...@gmail.com> wrote in message <hvmfie$44...@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?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us