<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Initializing Parameters</title>
	<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/</link>
	<description>This blog is about Simulink.</description>
	<pubDate>Mon, 23 Nov 2009 01:37:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-866</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Sat, 03 Oct 2009 15:41:21 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-866</guid>
		<description>@wei - I overlooked the X/2 expression.  That cannot be managed through memory layout.  It might be possible to create a Data Store that holds X, and diagramatically create Y (Stored in a Data Store) based on X.  Then when X and Y are used, the relationship would be correct (as long as execution of the blocks is grouped as an atomic unit).</description>
		<content:encoded><![CDATA[<p>@wei - I overlooked the X/2 expression.  That cannot be managed through memory layout.  It might be possible to create a Data Store that holds X, and diagramatically create Y (Stored in a Data Store) based on X.  Then when X and Y are used, the relationship would be correct (as long as execution of the blocks is grouped as an atomic unit).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-865</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Fri, 02 Oct 2009 21:26:42 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-865</guid>
		<description>@Seth,
I'm interested to see how the dependence of y on x is managed through memory layout. To me this should be part of model done diagrammatically.</description>
		<content:encoded><![CDATA[<p>@Seth,<br />
I&#8217;m interested to see how the dependence of y on x is managed through memory layout. To me this should be part of model done diagrammatically.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-864</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Fri, 02 Oct 2009 18:48:54 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-864</guid>
		<description>@Muhammad Arsalan - you have brought up an interesting problem.  It would be possible to tune parameters while the simulation is running (or paused) and keep them consistent.  I would use a cell in my script that initialized X and Y, then execute just that cell to update the values in the MATLAB workspace.  You can then update the diagram (Ctrl-D) to get the new values into the simulation.

The relationship between these variables will not be automatically recognized in generated code.  For that you will need to consider custom storage classes where you can layout the X memory as part of Y.  This will ensure consistency.

Anyone else have a suggestion?</description>
		<content:encoded><![CDATA[<p>@Muhammad Arsalan - you have brought up an interesting problem.  It would be possible to tune parameters while the simulation is running (or paused) and keep them consistent.  I would use a cell in my script that initialized X and Y, then execute just that cell to update the values in the MATLAB workspace.  You can then update the diagram (Ctrl-D) to get the new values into the simulation.</p>
<p>The relationship between these variables will not be automatically recognized in generated code.  For that you will need to consider custom storage classes where you can layout the X memory as part of Y.  This will ensure consistency.</p>
<p>Anyone else have a suggestion?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muhammad Arsalan</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-852</link>
		<dc:creator>Muhammad Arsalan</dc:creator>
		<pubDate>Tue, 15 Sep 2009 14:30:56 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-852</guid>
		<description>Hi Seth,

I am facing a very interesting problem about the parameter dependencies.
The problem is that i have to use some parameters which are dependent on other parameters. e.g.
x = 6 and y = [0, x, 10, 15, x/2]
Now when these parameters are loaded to the base workspace of MATLAB the dependency of y on x is lost. In base workspace the value of y is taken as [0, 6, 10, 15, 3]. By this depencency lose it is not possible to change the values in y when it is used in model, just by changing the x. Is there any way by which this lose of dependency is avoided.

Thank you very much indeed. 
Arsalan</description>
		<content:encoded><![CDATA[<p>Hi Seth,</p>
<p>I am facing a very interesting problem about the parameter dependencies.<br />
The problem is that i have to use some parameters which are dependent on other parameters. e.g.<br />
x = 6 and y = [0, x, 10, 15, x/2]<br />
Now when these parameters are loaded to the base workspace of MATLAB the dependency of y on x is lost. In base workspace the value of y is taken as [0, 6, 10, 15, 3]. By this depencency lose it is not possible to change the values in y when it is used in model, just by changing the x. Is there any way by which this lose of dependency is avoided.</p>
<p>Thank you very much indeed.<br />
Arsalan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-827</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Thu, 20 Aug 2009 01:03:19 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-827</guid>
		<description>@Alberto - I think you should set a break point in the function, and when you hit that point, you can step through the code to see what is the problem.  Note, your initialization code doesn't have to be this complicated.  In fact, you may want to build a MATLAB GUI using GUIDE and replace the OpenFcn for a subsystem. Good luck.

I think you will get a faster answer from &lt;a href="http://www.mathworks.com/support/" rel="nofollow"&gt;Technical Support&lt;/a&gt; or on &lt;a href="http://www.mathworks.com/matlabcentral/newsreader/" rel="nofollow"&gt;CSSM&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>@Alberto - I think you should set a break point in the function, and when you hit that point, you can step through the code to see what is the problem.  Note, your initialization code doesn&#8217;t have to be this complicated.  In fact, you may want to build a MATLAB GUI using GUIDE and replace the OpenFcn for a subsystem. Good luck.</p>
<p>I think you will get a faster answer from <a href="http://www.mathworks.com/support/" rel="nofollow">Technical Support</a> or on <a href="http://www.mathworks.com/matlabcentral/newsreader/" rel="nofollow">CSSM</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alberto cardeñoso</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-826</link>
		<dc:creator>alberto cardeñoso</dc:creator>
		<pubDate>Wed, 19 Aug 2009 09:34:51 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-826</guid>
		<description>Hello,
thank you Seth for your answer. I have written one script like this, 


function initialisation1

% Parameter settings for the simulation  
%

% Fist of all fetch parameters from the Adjust Settings block
%   
% Construct the whole name of the block
settings_block_name='Adjust Settings';
settings_block = [bdroot '/' settings_block_name];


[data_rate, ...
 modulation, ...
 channel_type,...
 SNR,...
 rolloff] = ...
   get_settings(settings_block,...
                'data_rate',...
                'modulation',...
                'channel_type',...
                'SNR',...
                'rolloff');


% Data Source, Sample Time and Frame Time
p.data_rate = data_rate;    % Data rate.


% Modulations Squeme
p.modulation = modulation;  % Selected modulation squeme: BPSK, QPSK, 8-PSK ...

% Transmit and receive filters
p.rolloff = rolloff;        % Roll-off factor of the transmit and receive filters.


% Channel parameters
p.channel_type = channel_type;  % Channel Type: AWGN, Rayleigh, Rice ...
p.SNR = SNR;                % SNR of the channel.


assignin('base','parameters',p);  


%-------------------------------------------------------------------------

function varargout=get_settings(settings_block,varargin)

h=get_param(settings_block,'handle');   % Get the handle of the block.
for n=1:length(varargin)
    varargout{n}=evalin('base', get(h,varargin{n}));
end

I don´t know why, but the get_settings function is not working. There is a problem with the
evalin function. The initialisation1 function is called from the mask initialisation of the "Settings Block", 
as well as from the PostLoadFcn from the Model.

Any idea?

THanks
Alberto</description>
		<content:encoded><![CDATA[<p>Hello,<br />
thank you Seth for your answer. I have written one script like this, </p>
<p>function initialisation1</p>
<p>% Parameter settings for the simulation<br />
%</p>
<p>% Fist of all fetch parameters from the Adjust Settings block<br />
%<br />
% Construct the whole name of the block<br />
settings_block_name=&#8217;Adjust Settings&#8217;;<br />
settings_block = [bdroot &#8216;/&#8217; settings_block_name];</p>
<p>[data_rate, &#8230;<br />
 modulation, &#8230;<br />
 channel_type,&#8230;<br />
 SNR,&#8230;<br />
 rolloff] = &#8230;<br />
   get_settings(settings_block,&#8230;<br />
                &#8216;data_rate&#8217;,&#8230;<br />
                &#8216;modulation&#8217;,&#8230;<br />
                &#8216;channel_type&#8217;,&#8230;<br />
                &#8216;SNR&#8217;,&#8230;<br />
                &#8216;rolloff&#8217;);</p>
<p>% Data Source, Sample Time and Frame Time<br />
p.data_rate = data_rate;    % Data rate.</p>
<p>% Modulations Squeme<br />
p.modulation = modulation;  % Selected modulation squeme: BPSK, QPSK, 8-PSK &#8230;</p>
<p>% Transmit and receive filters<br />
p.rolloff = rolloff;        % Roll-off factor of the transmit and receive filters.</p>
<p>% Channel parameters<br />
p.channel_type = channel_type;  % Channel Type: AWGN, Rayleigh, Rice &#8230;<br />
p.SNR = SNR;                % SNR of the channel.</p>
<p>assignin(&#8217;base&#8217;,'parameters&#8217;,p);  </p>
<p>%&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>function varargout=get_settings(settings_block,varargin)</p>
<p>h=get_param(settings_block,&#8217;handle&#8217;);   % Get the handle of the block.<br />
for n=1:length(varargin)<br />
    varargout{n}=evalin(&#8217;base&#8217;, get(h,varargin{n}));<br />
end</p>
<p>I don´t know why, but the get_settings function is not working. There is a problem with the<br />
evalin function. The initialisation1 function is called from the mask initialisation of the &#8220;Settings Block&#8221;,<br />
as well as from the PostLoadFcn from the Model.</p>
<p>Any idea?</p>
<p>THanks<br />
Alberto</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-825</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Tue, 18 Aug 2009 18:55:47 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-825</guid>
		<description>@alberto cardeñoso - Thanks for your question.  These kinds of blocks are usually just masked subsystems.  Try right clicking on the blocks and selecting, "Edit Mask".  If you look at the MaskInitialization code you can find that it just runs a script.  To see the content of that script,

&lt;pre style="font-size: 11pt;" class="code"&gt;
&gt;&gt; edit commwlan80211a_settings;
&lt;/pre&gt;

The code in the script performs a few get_param commands then assigns a variable into the base workspace.  This model is carefully constructed so that all those variables are accessed from the blocks in the model.  Double click on the blocks to see how.</description>
		<content:encoded><![CDATA[<p>@alberto cardeñoso - Thanks for your question.  These kinds of blocks are usually just masked subsystems.  Try right clicking on the blocks and selecting, &#8220;Edit Mask&#8221;.  If you look at the MaskInitialization code you can find that it just runs a script.  To see the content of that script,</p>
<pre style="font-size: 11pt;" class="code">
>> edit commwlan80211a_settings;
</pre>
<p>The code in the script performs a few get_param commands then assigns a variable into the base workspace.  This model is carefully constructed so that all those variables are accessed from the blocks in the model.  Double click on the blocks to see how.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alberto cardeñoso</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-824</link>
		<dc:creator>alberto cardeñoso</dc:creator>
		<pubDate>Tue, 18 Aug 2009 13:05:27 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-824</guid>
		<description>Hello,
what about initialisation with Simulinks models where a Simulation Settings block is present? One example is the IEEE® 802.11a WLAN Physical Layer Simulink Demo. How does it works?

Thanks.
Alberto.</description>
		<content:encoded><![CDATA[<p>Hello,<br />
what about initialisation with Simulinks models where a Simulation Settings block is present? One example is the IEEE® 802.11a WLAN Physical Layer Simulink Demo. How does it works?</p>
<p>Thanks.<br />
Alberto.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hossein</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-797</link>
		<dc:creator>Hossein</dc:creator>
		<pubDate>Tue, 07 Jul 2009 04:30:26 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-797</guid>
		<description>Thanks. This was helpful! :-)</description>
		<content:encoded><![CDATA[<p>Thanks. This was helpful! :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachid</title>
		<link>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-783</link>
		<dc:creator>Rachid</dc:creator>
		<pubDate>Thu, 25 Jun 2009 15:16:02 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/#comment-783</guid>
		<description>hello 

I have a model with many blocs, the last have also the blocs and parameters,  so  i  want  to  get all  these parameters, make them in struct and  respect the path of any blocs and  parameters
 so there are the function who  do  this?</description>
		<content:encoded><![CDATA[<p>hello </p>
<p>I have a model with many blocs, the last have also the blocs and parameters,  so  i  want  to  get all  these parameters, make them in struct and  respect the path of any blocs and  parameters<br />
 so there are the function who  do  this?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
