From: Kimonas Fountoulakis on 11 Jun 2010 22:04 Hi I have a matlab function, "getData" which has a random generator in it. Whenever I call the getData function like this: [A,b,xs,xsn] = getData(2,4,1,0,1,0,0,200) <- the last parameter is the seed if I have a the same seed at every call I get the same result, which is normal. But when I call getData through a mex file, with exactly the same parameters as above I get different results, plus even if I call my mex file many times with fixed parameters, I get everytime different results. It behaves like there is no seed parameter (or every time the seed is different). Any ideas?? Thanks in advance
From: Steven Lord on 14 Jun 2010 11:18 "Kimonas Fountoulakis" <kfoynt(a)hotmail.com> wrote in message news:huupuk$p8o$1(a)fred.mathworks.com... > Hi > I have a matlab function, "getData" which has a random generator in it. > Whenever I call the getData function like this: > > [A,b,xs,xsn] = getData(2,4,1,0,1,0,0,200) <- the last parameter is the > seed > > if I have a the same seed at every call I get the same result, which is > normal. > But when I call getData through a mex file, with exactly the same > parameters as above I get different results, plus even if I call my mex > file many times with fixed parameters, I get everytime different results. > It behaves like there is no seed parameter (or every time the seed is > different). > > Any ideas?? Yes -- this problem is going to be impossible to debug without seeing a simplified (aka short) version of getData and your MEX-file with which you can reproduce the problem. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Jan Simon on 14 Jun 2010 12:26 Dear Kimonas! > I have a matlab function, "getData" which has a random generator in it. Whenever I call the getData function like this: > > [A,b,xs,xsn] = getData(2,4,1,0,1,0,0,200) <- the last parameter is the seed > > if I have a the same seed at every call I get the same result, which is normal. > But when I call getData through a mex file, with exactly the same parameters as above I get different results, plus even if I call my mex file many times with fixed parameters, I get everytime different results. It behaves like there is no seed parameter (or every time the seed is different). Either your Mex calls getData without a 8th argument, of the 8th argument is random, e.g. if you use the address of a variable instead of the value. But of course, an answer could be much more detailed, if you'd show the corresponding lines of code... Jan
From: Patrick on 14 Jun 2010 12:40 I would suggest doing a mexPrintf to verify that you read in your parameters correctly. "Kimonas Fountoulakis" <kfoynt(a)hotmail.com> wrote in message <huupuk$p8o$1(a)fred.mathworks.com>... > Hi > > I have a matlab function, "getData" which has a random generator in it. Whenever I call the getData function like this: > > [A,b,xs,xsn] = getData(2,4,1,0,1,0,0,200) <- the last parameter is the seed > > if I have a the same seed at every call I get the same result, which is normal. > But when I call getData through a mex file, with exactly the same parameters as above I get different results, plus even if I call my mex file many times with fixed parameters, I get everytime different results. It behaves like there is no seed parameter (or every time the seed is different). > > Any ideas?? > > Thanks in advance
|
Pages: 1 Prev: Object length-width measurement Next: Move 3d object with wiimote.. |