From: Alain on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hio0vq$2o1$1(a)fred.mathworks.com>...
> "Alain " <berdoz(a)code7136.nrl.navy.mil> wrote in message <hinusf$hj1$1(a)fred.mathworks.com>...
>
> > But it seems to work properly when I use the proposed solution:
> > S = load...
> > then funtion(S.X)
> > I am sure I do not know the difference, but can not argue with success....
>
> I can't know precisely what's going on without seeing your full code, and also possibly without seeing what function names are on your path.
>
> Generally speaking though, it is a hazardous coding practice to introduce variables into a workspace without an explicit assignment statement, as for example using
> load(), eval(), evalin(), assignin(), etc...
>
> This practice, called "poofing" in some circles, has some known dangers discussed for example in the threads below. None of them seem to match up precisely with what you're reporting, but again, I would need to know a lot more about what's in your workspace...
>
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/244639#628695
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/270127
>
>
>
> In any case, it was clear to me that whos() in some way forces MATLAB to rescan the workspace for any poofed variables it didn't initially catch, which is why it apparently corrected the problem for you.
>
> The bottom line, for you, is that you should always pipe the output of load to a structure and then if need be unpack the fields of the structure into separate variables
>
> S=load(...)
> A=S.A; B=S.B; C=S.C, etc...
>
> as I had proposed. If you find this cumbersome, I created this FEX tool to cut down on the work:
>
> http://www.mathworks.com/matlabcentral/fileexchange/26216-structure-fields-to-variables

thanks for the thorough response !
From: Matt J on
"Alain " <berdoz(a)code7136.nrl.navy.mil> wrote in message <hio1kh$e4u$1(a)fred.mathworks.com>...

>
> thanks for the thorough response !

No problem. If you ever figure out why the poofing of X into your workspace caused problems, I'd be grateful if you could post the explanation. I have a certain interest in cataloguing the different problems that poofing can cause and yours seems like a new one!
From: Matt Fig on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hio2b1$sht$1(a)fred.mathworks.com>...
> "Alain " <berdoz(a)code7136.nrl.navy.mil> wrote in message <hio1kh$e4u$1(a)fred.mathworks.com>...
>
> >
> > thanks for the thorough response !
>
> No problem. If you ever figure out why the poofing of X into your workspace caused problems, I'd be grateful if you could post the explanation. I have a certain interest in cataloguing the different problems that poofing can cause and yours seems like a new one!


I too would like to see the code that caused the problem. I seem to remember a thread where WHOS cured a problem very similar to this one about 5 months ago, but I cannot find it.
From: Loren Shure on
In article <hio31v$ekl$1(a)fred.mathworks.com>, spamanon(a)yahoo.com says...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hio2b1$sht$1(a)fred.mathworks.com>...
> > "Alain " <berdoz(a)code7136.nrl.navy.mil> wrote in message <hio1kh$e4u$1(a)fred.mathworks.com>...
> >
> > >
> > > thanks for the thorough response !
> >
> > No problem. If you ever figure out why the poofing of X into your workspace caused problems, I'd be grateful if you could post the explanation. I have a certain interest in cataloguing the different problems that poofing can cause and yours seems like a new one!
>
>
> I too would like to see the code that caused the problem. I seem to remember a thread where WHOS cured a problem very similar to this one about 5 months ago, but I cannot find it.
>

is it possible you have a program on your path with the same name as the
variable? That could've caused all kinds of mayhem/confusion to matlab
and caused an error.

--
Loren
http://blogs.mathworks.com/loren
From: Matt J on
Loren Shure <loren.shure(a)mathworks.com> wrote in message <MPG.25ba36004953ef8a989aa1(a)news.mathworks.com>...
> In article <hio31v$ekl$1(a)fred.mathworks.com>, spamanon(a)yahoo.com says...
> > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hio2b1$sht$1(a)fred.mathworks.com>...
> > > "Alain " <berdoz(a)code7136.nrl.navy.mil> wrote in message <hio1kh$e4u$1(a)fred.mathworks.com>...
> > >
> > > >
> > > > thanks for the thorough response !
> > >
> > > No problem. If you ever figure out why the poofing of X into your workspace caused problems, I'd be grateful if you could post the explanation. I have a certain interest in cataloguing the different problems that poofing can cause and yours seems like a new one!
> >
> >
> > I too would like to see the code that caused the problem. I seem to remember a thread where WHOS cured a problem very similar to this one about 5 months ago, but I cannot find it.
> >
>
> is it possible you have a program on your path with the same name as the
> variable? That could've caused all kinds of mayhem/confusion to matlab
> and caused an error.
>

That's what I thought too, Loren, but the error message the OP is reporting is not consistent with that. He claims an error message of "variable undefined" whereas if a function were shadowing the variable, he should see a message of "Insufficient arguments to function X()" or something along those lines.


First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Subcript
Next: CRC-32 for IEEE 802.11-2007