Using RandStream objects in mask initialization code

Is it possible to use a RandStream object in mask initialization code? For example, in the mask initialization, I'd like to be able to write:
x = rand(mystream,2);
where 'mystream' is a RandStream object. But since the mask initialization code runs in the mask workspace, how can the stream get there? Can streams be sent into the mask as dialog parameters? Is the only option to create mystream in the base workspace and use something like evalin in the mask initialzation code to get to it? Or maybe load mystream in from a file? Other options? What if the mask resides inside a referenced model? Does that matter?

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 10월 23일

0 개 추천

I just tried this, and it looks like you should be able to pass in a RandStream object as a mask (dialog) parameter. Does that not work for you?

댓글 수: 1

Paul
Paul 2012년 10월 23일
It might work in some cases. I was thinking about possibly passing a RandStream object into a referenced model via Model arguments and using it to randomly initialize a parameter in a masked subsystem in the mask initialization code. Don't know if this is even feasible, but I stopped investigating once I learned that mask initializations and model arguments don't play nice together.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Author Block Masks에 대해 자세히 알아보기

제품

질문:

2012년 10월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by