why function showing not defined in enthought canopy?

165 views Asked by At

I am a new user in Enthought Canopy Python.

** At first I tried to run the code, it gave error message e.g.

MatrixCreate is not defined.

** Then I tried importing the file by typing command: e.g.

import file.py ; it gave error "no module named file.py"

** Then I tried:

import MatrixCreate(1, 50);

gave me error message invalid syntax with arrow directing before braces.

** Then I tried importing the function from matplot: e.g.

from matplotlib import matrixcreate;

it gave error message

cannot import matrixcreate

** further I tried:

matrixcreate.show(); 

gave me error

name 'matixcreate' is not defined

Please guide how I can run my code.

1

There are 1 answers

0
UN4 On BEST ANSWER

MatrixCreate does not appear to be a part of any module that you could import. Most probably you are using some incomplete code that is missing a function called MatrixCreate. However, to create an empty matrix of the size [1, 50] use:

import numpy
matrix = numpy.zeros(shape=(1,50))
print matrix

you can further make a function that creates a matrix for you:

import numpy
def MatrixCreate(a,b):
   matrix = numpy.zeros(shape=(a,b))
   return matrix
print MatrixCreate(1,50)