Variable Name - Function Name conflict

Discussion in 'MATLAB' started by jeb, Oct 22, 2004.

  1. jeb

    jeb Guest

    I have a matrix variable named 'poly'.

    From the command line I can make an assignment like X = poly;

    However in a function:
    load 'foo' %which contains a variable named 'poly'
    X = poly;

    Result: the 'poly' function is called, not the variable assignment.

    I know I can (and should) rename my variable to avoid the naming
    conflict. I was just wondering if there is a way to change the
    'search' path, so the variable is found, before the function name...
    'poly'.

    Thanks,

    jeb
     
    jeb, Oct 22, 2004
    #1
    1. Advertisements

  2. The problem is that the parser that runs before running the code doesn't
    realise that you have "POOFED" (As SLord calls it) the variable poly into
    existence. Add a line
    before the load like this:

    poly=[];

    Also see this link:
    http://newsreader.mathworks.com/[email protected]
     
    Murphy O'Brien, Oct 22, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.