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:
MATLAB

Subject: MATLAB

From: biswajittalk

Date: 2 Feb, 2011 16:18:14

Message: 1 of 2

I have an array A of order nxn. I want to plot A(i,j) at the points (i,j) in the figure.
I tried with
  for i=1:n
      for j=1:n
        text(i,j, 'A(i,j)')
      end
  end
It only displays A(i,j) not its contents in the array A.
Please help.

Subject: MATLAB

From: Sean de

Date: 2 Feb, 2011 16:52:03

Message: 2 of 2

biswajittalk <biswajittalk@gmail.com> wrote in message <2001442530.33012.1296663524440.JavaMail.root@gallium.mathforum.org>...
> I have an array A of order nxn. I want to plot A(i,j) at the points (i,j) in the figure.
> I tried with
> for i=1:n
> for j=1:n
> text(i,j, 'A(i,j)')
> end
> end
> It only displays A(i,j) not its contents in the array A.
> Please help.

You're giving it a string not a reference to ith,jth location. Extract the value and then convert to string:
  text(i,j, num2str(A(i,j)))


%SCd

Tags for this Thread

No tags are associated with 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