diff options
Diffstat (limited to 'js/Sources/RAND_m.js')
-rw-r--r-- | js/Sources/RAND_m.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index f7d0217b..56333efc 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -24,9 +24,9 @@ function RAND_m() { this.model.blocktype = new ScilabString(["d"]); this.model.firing = new ScilabDouble([]); this.model.dep_ut = new ScilabDouble([false,false]); - var exprs = [[sci2exp(1)],[string(this.flag)],[sci2exp([this.a])],[sci2exp([this.b])],[sci2exp([this.model.dstate[1-1],int(rand()*(10^7-1))])]]; - var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"RAND_m\",sz(1),sz(2));"]); - this.x = standard_define([3,2],this.model,exprs,gr_i); + this.exprs = [[sci2exp(1)],[string(this.flag)],[sci2exp([this.a])],[sci2exp([this.b])],[sci2exp([this.model.dstate[1-1],int(rand()*(10^7-1))])]]; + this.gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"RAND_m\",sz(1),sz(2));"]); + this.x = standard_define([3,2],this.model,this.exprs,this.gr_i); return new BasicBlock(this.x); } RAND_m.prototype.details = function RAND_m() { @@ -48,15 +48,16 @@ function RAND_m() { this.a = parseFloat(arguments[0]["a"]) this.b = parseFloat(arguments[0]["b"]) this.seed_c = arguments[0]["seed_c"] + this.exprs = arguments[0]["exprs"] this.x = arg1; this.graphics = arg1.graphics; - var exprs = this.graphics.exprs; + this.exprs = this.graphics.exprs; this.model = arg1.model; - if (size(exprs,"*")==14) { - exprs[9-1] = []; + if (size(this.exprs,"*")==14) { + this.exprs[9-1] = []; } while (true) { - [ok,this.typ,this.flag,this.a,this.b,this.seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],["Datatype(1=real double 2=complex)","flag","A","B","SEED"],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); + [ok,this.typ,this.flag,this.a,this.b,this.seed_c,this.exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],["Datatype(1=real double 2=complex)","flag","A","B","SEED"],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),this.exprs); if (!ok) { break; } @@ -85,7 +86,7 @@ function RAND_m() { var ok = tmpvar0[2]; if (ok) { this.model.sim = list(new ScilabString([function_name]), new ScilabDouble([4])); - this.graphics.exprs = new ScilabDouble([exprs]); + this.graphics.exprs = new ScilabDouble([this.exprs]); this.model.ipar = new ScilabDouble([this.flag]); this.x.graphics = this.graphics; this.x.model = this.model; |