From: Arvind Kumar on
Hi,

My question about sending a matlab value to workspace and then use it in a simulink model. I ve written a matlab function as an m-file and I run a simulink model inside the function using the 'sim' command.
I have to run this function many times through the GA toolbox by varying some parameters in the simulink block for every run. But values from the m-file function dont get passed to simulink because they are not defined in the work space. How can I do this?....

Any help or suggestions are greatly appreciated

Thank u..........

Arvind
From: us on
"Arvind Kumar " <arvindkumarms(a)gmail.com> wrote in message <hqcqm2$6f4$1(a)fred.mathworks.com>...
> Hi,
>
> My question about sending a matlab value to workspace and then use it in a simulink model. I ve written a matlab function as an m-file and I run a simulink model inside the function using the 'sim' command.
> I have to run this function many times through the GA toolbox by varying some parameters in the simulink block for every run. But values from the m-file function dont get passed to simulink because they are not defined in the work space. How can I do this?....
>
> Any help or suggestions are greatly appreciated
>
> Thank u..........
>
> Arvind

a hint:

help assignin;

us
From: Arvind Kumar on
Thank u so much...found your hint quite helpful....
From: Arvind Kumar on
"us " <us(a)neurol.unizh.ch> wrote in message <hqcsvm$b0k$1(a)fred.mathworks.com>...
> "Arvind Kumar " <arvindkumarms(a)gmail.com> wrote in message <hqcqm2$6f4$1(a)fred.mathworks.com>...
> > Hi,
> >
> > My question about sending a matlab value to workspace and then use it in a simulink model. I ve written a matlab function as an m-file and I run a simulink model inside the function using the 'sim' command.
> > I have to run this function many times through the GA toolbox by varying some parameters in the simulink block for every run. But values from the m-file function dont get passed to simulink because they are not defined in the work space. How can I do this?....
> >
> > Any help or suggestions are greatly appreciated
> >
> > Thank u..........
> >
> > Arvind
>
> a hint:
>
> help assignin;
>
> us

Thanks....found it quiet useful.....
Arvind
From: Steven Lord on

"Arvind Kumar " <arvindkumarms(a)gmail.com> wrote in message
news:hqcqm2$6f4$1(a)fred.mathworks.com...
> Hi,
>
> My question about sending a matlab value to workspace and then use it in a
> simulink model. I ve written a matlab function as an m-file and I run a
> simulink model inside the function using the 'sim' command. I have to run
> this function many times through the GA toolbox by varying some parameters
> in the simulink block for every run. But values from the m-file function
> dont get passed to simulink because they are not defined in the work
> space. How can I do this?....

Set the SrcWorkspace option using SIMSET to tell the Simulink model that you
invoke using SIM to look in the current function's workspace.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ