help-octave
[Top][All Lists]
Advanced

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

Re: Scatter does not allow non conformant arguments


From: Nicholas Jankowski
Subject: Re: Scatter does not allow non conformant arguments
Date: Wed, 25 Nov 2015 13:46:49 -0500

On Wed, Nov 25, 2015 at 1:09 PM, Jonathan Camilleri <address@hidden> wrote:
Can anyone help me figure out what is wrong here, I am trying to use a matrix which is 150x4, and, I do not understand the validation, unfortunately.

The errors are not very clear.

scatter(iris_data, min(iris_data), 'o')
error: __scatter__: mx_el_or: nonconformant arguments (op1 is 600x1, op2 is 4x1)
error: called from
    __scatter__ at line 52 column 7
    scatter at line 86 column 10

Regards,



I'm assuming iris_data is loaded directly from the csv file you attached. the scatter function is confused about your two input vectors and how to use them to make x,y pairs for plotting. 

what it's saying is that your two input vectors (or matrices) are not the same size ("nonconformant arguments").  it wants scatter(x,y), and you've given more x's than y's.  if it sees a matrix, it internally looks at it as a vector (stacking your four columns to give a 600x1 array), and expects it to pair up element-by-element with the other matrix or vector. 

You should look at your second input, min(iris_data), at the command line to visualize the problem. on a vector, min() returns the min.  from help min:  "For a vector argument, return the minimum value.  For a matrix argument, return a row vector with the minimum value of each column.  For a multi-dimensional array, `min' operates along the first non-singleton dimension." 

so, for you min(iris_data) returns a 1x4 array. you're now passing a 150x4 array and a 1x4 array into scatter(). Octave has no idea what to do with that.  I don't know what you were trying to do by pulling out the minimum of the data, but if you wanted a single value, you'd need 'min(min(iris_data))'.  that would still fail, however, as you'd be passing a 150x4 and a scalar, and Octave would still be confused.

What are you trying to plot here?

Nick J.

reply via email to

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