<?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: Use Dynamic Field References</title>
	<link>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/</link>
	<description>Loren Shure  works on design of the MATLAB language at The MathWorks. She writes here about once a week on MATLAB programming and related topics. </description>
	<pubDate>Mon, 08 Sep 2008 03:49:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Mag</title>
		<link>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-16338</link>
		<dc:creator>Mag</dc:creator>
		<pubDate>Thu, 02 Aug 2007 16:10:23 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-16338</guid>
		<description>I happen to pass by your blog and saw your entries on MATLAB. 
I would like to ask you regarding structure used in MATLAB. 
But I am a beginner of MATLAB but I have to work on a project on B-splines. 

&#62;&#62;&#62;&#62; My problem is that I currently can only plot one spline on the axes. My data will always be over-written the moment I plot another axes. However, when I read from the MATLAB book. It seems that the example are assigning data to structure in a less interactive way with the user. Is there any ways that I can work on the data clicked by the user. Then retrieving the relevant data upon selecting on the spline drawn.

Another problem of mine is that, after I have shifted the original spline to another location. After I apply 'cla' function, all the splines have been deleted. Is there any other functions that I can used to delete the original spline after shifting the spline to a new location without deleting other splines on the axes.

Thanks a million,
Magdalene</description>
		<content:encoded><![CDATA[<p>I happen to pass by your blog and saw your entries on MATLAB.<br />
I would like to ask you regarding structure used in MATLAB.<br />
But I am a beginner of MATLAB but I have to work on a project on B-splines. </p>
<p>&gt;&gt;&gt;&gt; My problem is that I currently can only plot one spline on the axes. My data will always be over-written the moment I plot another axes. However, when I read from the MATLAB book. It seems that the example are assigning data to structure in a less interactive way with the user. Is there any ways that I can work on the data clicked by the user. Then retrieving the relevant data upon selecting on the spline drawn.</p>
<p>Another problem of mine is that, after I have shifted the original spline to another location. After I apply &#8216;cla&#8217; function, all the splines have been deleted. Is there any other functions that I can used to delete the original spline after shifting the spline to a new location without deleting other splines on the axes.</p>
<p>Thanks a million,<br />
Magdalene</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-16015</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 09 Jan 2007 12:08:24 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-16015</guid>
		<description>Pietro-

There are no issues with using dynamic field referencing and the compiler.  I don't see how using feval helps in any way.  This method should be robust.

--Loren</description>
		<content:encoded><![CDATA[<p>Pietro-</p>
<p>There are no issues with using dynamic field referencing and the compiler.  I don&#8217;t see how using feval helps in any way.  This method should be robust.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PIETRO</title>
		<link>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-16014</link>
		<dc:creator>PIETRO</dc:creator>
		<pubDate>Tue, 09 Jan 2007 11:31:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-16014</guid>
		<description>I am writing Matlab code using this notation in order to manage fields in Matlab. I think it is a very good method. I am wondering if codes written using this notation could lead some problems when Matlab Compiler is applied, as it happens for the "eval" function.
Eventually I ask you whether the use of "feval" can solve this problem or not.

Thank you very much.

Pietro Garofalo</description>
		<content:encoded><![CDATA[<p>I am writing Matlab code using this notation in order to manage fields in Matlab. I think it is a very good method. I am wondering if codes written using this notation could lead some problems when Matlab Compiler is applied, as it happens for the &#8220;eval&#8221; function.<br />
Eventually I ask you whether the use of &#8220;feval&#8221; can solve this problem or not.</p>
<p>Thank you very much.</p>
<p>Pietro Garofalo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed Limbaugh</title>
		<link>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-28</link>
		<dc:creator>Ed Limbaugh</dc:creator>
		<pubDate>Tue, 07 Feb 2006 19:56:08 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/#comment-28</guid>
		<description>I just stumbled across Loren's blog quite by accident, and I really enjoy reading through the older postings.   I think there is a solution to the second point in the Contraindications section of the article about dynamic field references: "If you don't know the overall structure of your struct, ... it's hard to program generically with .()"

Use  'fieldnames' to retrieve the names of all fields at one level of the structure.  I've done something similar to the following a number of times:

fn = fieldnames(mystruct);
for lp=1:length(fn)
    doSomeOperation( mystruct.( fn{lp} ) );
end

I've become more comfortable just using the field names as the loop arguments outright.

fn = fieldnames(mystruct);
for lp=fn
    doSomeOperation( mystruct( lp{:} ) );
end

This works very well for homogenous structures or when your 'doSomeOperation' function knows how to handle different input types.
For example, you might define doSomeOperation like this:

function x = doSomeOperation(y)
if ~isnumeric(y)
    x = [];
else
   x = doSomethingForReal(y);
end


Anyway, it's a thought.</description>
		<content:encoded><![CDATA[<p>I just stumbled across Loren&#8217;s blog quite by accident, and I really enjoy reading through the older postings.   I think there is a solution to the second point in the Contraindications section of the article about dynamic field references: &#8220;If you don&#8217;t know the overall structure of your struct, &#8230; it&#8217;s hard to program generically with .()&#8221;</p>
<p>Use  &#8216;fieldnames&#8217; to retrieve the names of all fields at one level of the structure.  I&#8217;ve done something similar to the following a number of times:</p>
<p>fn = fieldnames(mystruct);<br />
for lp=1:length(fn)<br />
    doSomeOperation( mystruct.( fn{lp} ) );<br />
end</p>
<p>I&#8217;ve become more comfortable just using the field names as the loop arguments outright.</p>
<p>fn = fieldnames(mystruct);<br />
for lp=fn<br />
    doSomeOperation( mystruct( lp{:} ) );<br />
end</p>
<p>This works very well for homogenous structures or when your &#8216;doSomeOperation&#8217; function knows how to handle different input types.<br />
For example, you might define doSomeOperation like this:</p>
<p>function x = doSomeOperation(y)<br />
if ~isnumeric(y)<br />
    x = [];<br />
else<br />
   x = doSomethingForReal(y);<br />
end</p>
<p>Anyway, it&#8217;s a thought.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
