Filter löschen
Filter löschen

plotting within nested for loop

1 Ansicht (letzte 30 Tage)
MiauMiau
MiauMiau am 18 Jun. 2014
Kommentiert: MiauMiau am 18 Jun. 2014
Hi This is toy code similar to what I want to achieve:
T = randi(10,10)
Q = randi(10,10)
hold on
for i = 1:10
for j = 1:10
plot(T(i,j),Q(i,j))
end
end
hold off
and my goal is to the corresponding elements of the two matrices in a plot. Yet it does not work - where is the problem?
  1 Kommentar
Rashmil Dahanayake
Rashmil Dahanayake am 18 Jun. 2014
The original code works fine. What errors are you referring to

Melden Sie sich an, um zu kommentieren.

Antworten (1)

SRI
SRI am 18 Jun. 2014
Your Code Is working Properly only, Please be precise with your question, so that we can solve your issue
  1 Kommentar
MiauMiau
MiauMiau am 18 Jun. 2014
It does indeed, but I had to restart Matlab. Formerly nothing happened. Another question though: Both my matrices are symmetric, and to reduce complexity I obviously do not want to plot the duplicate points (obviously plot(T(1,2),Q(1,2)) would be the same as plot(T(2,1),Q(2,1)) etc. Do you have a suggestion how I could achieve that?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by