octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47149] line ([x1, x2]', [y1, y2]) works in Ma


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #47149] line ([x1, x2]', [y1, y2]) works in Matlab but not Octave
Date: Wed, 17 Feb 2016 16:39:18 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #3, bug #47149 (project octave):

Lachlan, in your title example the length of the vector matches. That is all
that Matlab needs.

What works (in ML 2014a) is e.g. (by the absence of error messages),

>> a = rand (3, 5)
a =
    0.8147    0.9134    0.2785    0.9649    0.9572
    0.9058    0.6324    0.5469    0.1576    0.4854
    0.1270    0.0975    0.9575    0.9706    0.8003
>> b = [1 : 3]
b =
     1     2     3
>> plot (b, a)
>> plot (b, a')
>> plot (b', a')
>> plot (b', a)
>> plot (a, b)


(note that in the last example the plot is rotated 90 degrees relative to the
previous examples).

But ML has limitations:

>> c = [1 : 3; 4: 6]
c =
     1     2     3
     4     5     6
>> plot (c, a)
Error using plot
Vectors must be the same lengths.
>> d = rand (3, 5, 2)
d(:,:,1) =
    0.1419    0.7922    0.0357    0.6787    0.3922
    0.4218    0.9595    0.8491    0.7577    0.6555
    0.9157    0.6557    0.9340    0.7431    0.1712
d(:,:,2) =
    0.7060    0.0462    0.6948    0.0344    0.7655
    0.0318    0.0971    0.3171    0.4387    0.7952
    0.2769    0.8235    0.9502    0.3816    0.1869
>> plot (b, d)
Error using plot
Data may not have more than 2 dimensions 


...so one of the arguments to plot must be a vector, the other can be a matrix
of which at least one dimension must have the same length as the vector
argument.

AFAICS Matlab first tries to match dimensions/orientations as specified on the
command line/instruction, and if it finds no match, tries rotating arguments
until it finds common lengths, otherwise fails with an error message.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47149>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]