<?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: Mental Model for feval</title>
	<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/</link>
	<description>Loren Shure  works on design of the MATLAB language at &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62;. She writes here about once a week on MATLAB programming and related topics. &#60;br&#62;&#60;br&#62;&#60;a href="/images/loren-full.jpg"&#62;&#60;img src="/images/loren.jpg"&#62;&#60;/a&#62;</description>
	<pubDate>Sun, 08 Nov 2009 01:59:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-29899</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 01 Dec 2008 22:29:35 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-29899</guid>
		<description>Ryan-

Yes, I was limiting my thoughts to M-files, not mex-files.  For mex-files, I believe you have to call feval with function handles currently.

--Loren</description>
		<content:encoded><![CDATA[<p>Ryan-</p>
<p>Yes, I was limiting my thoughts to M-files, not mex-files.  For mex-files, I believe you have to call feval with function handles currently.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ollos</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-29898</link>
		<dc:creator>Ryan Ollos</dc:creator>
		<pubDate>Mon, 01 Dec 2008 22:26:05 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-29898</guid>
		<description>Loren,

I found it was necessary to use feval in order to evaluate a function handle in the MATLAB workspace from within a mex function, using mexCallMATLAB.  

In this case, I couldn't find a way to evaluate the function handle directly.  This is the only time I can recall ever having to use feval.

It appears that mexCallMATLAB builds a string from the input arguments and evals it in the caller workspace, which I think it the reason why I had to all feval working with a function handle.

The relevant portions of my code are:

% call mexFEval on function handle, returning 1 arg
% fh is a handle to a nested function
r = mexFEval(fh);

---

% the mex function has a single line (aside from error checking)

mexCallMATLAB(nlhs, plhs, nrhs, prhs, "feval");


- Ryan</description>
		<content:encoded><![CDATA[<p>Loren,</p>
<p>I found it was necessary to use feval in order to evaluate a function handle in the MATLAB workspace from within a mex function, using mexCallMATLAB.  </p>
<p>In this case, I couldn&#8217;t find a way to evaluate the function handle directly.  This is the only time I can recall ever having to use feval.</p>
<p>It appears that mexCallMATLAB builds a string from the input arguments and evals it in the caller workspace, which I think it the reason why I had to all feval working with a function handle.</p>
<p>The relevant portions of my code are:</p>
<p>% call mexFEval on function handle, returning 1 arg<br />
% fh is a handle to a nested function<br />
r = mexFEval(fh);</p>
<p>&#8212;</p>
<p>% the mex function has a single line (aside from error checking)</p>
<p>mexCallMATLAB(nlhs, plhs, nrhs, prhs, &#8220;feval&#8221;);</p>
<p>- Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Simoneau</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-223</link>
		<dc:creator>Matthew Simoneau</dc:creator>
		<pubDate>Tue, 30 May 2006 13:40:39 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-223</guid>
		<description>FYI, the page I linked to above has moved to &lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f7-59595.html" rel="nofollow"&gt;a new location&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>FYI, the page I linked to above has moved to <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f7-59595.html" rel="nofollow">a new location</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Simoneau</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-26</link>
		<dc:creator>Matthew Simoneau</dc:creator>
		<pubDate>Mon, 06 Feb 2006 15:32:47 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-26</guid>
		<description>I'm constantly surprised to find relatively sophisticated MATLAB users who are unfamiliar with this "command/function duality".  A &lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/ch05_m23.html#matlab_calling_syntax"&gt;section in the MATLAB documentation&lt;/a&gt; describes it clearly, but many people never see it:</description>
		<content:encoded><![CDATA[<p>I&#8217;m constantly surprised to find relatively sophisticated MATLAB users who are unfamiliar with this &#8220;command/function duality&#8221;.  A <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/ch05_m23.html#matlab_calling_syntax">section in the MATLAB documentation</a> describes it clearly, but many people never see it:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-22</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Tue, 31 Jan 2006 19:57:39 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-22</guid>
		<description>I'll agree with Per here: I certainly fall victim to "transparency to documentation" occasionally. But sometimes that's more of a problem with the user (including myself) that MATLAB shouldn't have to fix; certainly big things like "Notes For C Programmers" are completely necessary and put up appropriately large red flags for common mental model errors when jumping between C and MATLAB.

However an advantage with MATLAB is that you can browse the source of many MATLAB functions to get a direct view (and a good complement to documentation) of what's going on under the hood, unless they are builtin, like 'dir' :-(.</description>
		<content:encoded><![CDATA[<p>I&#8217;ll agree with Per here: I certainly fall victim to &#8220;transparency to documentation&#8221; occasionally. But sometimes that&#8217;s more of a problem with the user (including myself) that MATLAB shouldn&#8217;t have to fix; certainly big things like &#8220;Notes For C Programmers&#8221; are completely necessary and put up appropriately large red flags for common mental model errors when jumping between C and MATLAB.</p>
<p>However an advantage with MATLAB is that you can browse the source of many MATLAB functions to get a direct view (and a good complement to documentation) of what&#8217;s going on under the hood, unless they are builtin, like &#8216;dir&#8217; :-(.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: loren</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-20</link>
		<dc:creator>loren</dc:creator>
		<pubDate>Tue, 31 Jan 2006 16:53:06 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-20</guid>
		<description>Krisna-

Welcome to the MATLAB community!  I recommend you read &lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/learn_matlab.html" rel="nofollow"&gt;Getting Started with MATLAB&lt;/a&gt;, run demos, read the Usenet MATLAB newsgroup &lt;a href="http://www.mathworks.com/matlabcentral/newsreader.html" rel="nofollow"&gt;comp.soft-sys.matlab&lt;/a&gt;, and watch &lt;a href="http://blogs.mathworks.com/loren" rel="nofollow"&gt;this blog&lt;/a&gt; for helpful topics.</description>
		<content:encoded><![CDATA[<p>Krisna-</p>
<p>Welcome to the MATLAB community!  I recommend you read <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/learn_matlab.html" rel="nofollow">Getting Started with MATLAB</a>, run demos, read the Usenet MATLAB newsgroup <a href="http://www.mathworks.com/matlabcentral/newsreader.html" rel="nofollow">comp.soft-sys.matlab</a>, and watch <a href="http://blogs.mathworks.com/loren" rel="nofollow">this blog</a> for helpful topics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: krishna kr tiwari</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-19</link>
		<dc:creator>krishna kr tiwari</dc:creator>
		<pubDate>Tue, 31 Jan 2006 15:31:28 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-19</guid>
		<description>I am a post graguate student.Studing in master of eectronics science.I currently worked on MATLAB but nobody know about the MATLAB.So please you give me a proper guiedens.


              krisna kr tiwari
              IPS ACADEMY.Indore(M.P.)
                        INDIA</description>
		<content:encoded><![CDATA[<p>I am a post graguate student.Studing in master of eectronics science.I currently worked on MATLAB but nobody know about the MATLAB.So please you give me a proper guiedens.</p>
<p>              krisna kr tiwari<br />
              IPS ACADEMY.Indore(M.P.)<br />
                        INDIA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: per isakson</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-18</link>
		<dc:creator>per isakson</dc:creator>
		<pubDate>Thu, 26 Jan 2006 15:13:55 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-18</guid>
		<description>RTFM. The problem (to some of us) is that we already have mental models of *commands* like DIR, SAVE, and PRINT when we try Matlab for the first time. Our models work  well with Matlab when we start using it *interactively*. Our models are so well established that *looking through* the documentation of the commands does not change our models.

To me a problem with the Matlab documentation is that I tend to overlook powerful (added) features of functions because they are "hidden" in the body text of the descriptions and not addressed by the examples.</description>
		<content:encoded><![CDATA[<p>RTFM. The problem (to some of us) is that we already have mental models of *commands* like DIR, SAVE, and PRINT when we try Matlab for the first time. Our models work  well with Matlab when we start using it *interactively*. Our models are so well established that *looking through* the documentation of the commands does not change our models.</p>
<p>To me a problem with the Matlab documentation is that I tend to overlook powerful (added) features of functions because they are &#8220;hidden&#8221; in the body text of the descriptions and not addressed by the examples.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: loren</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-17</link>
		<dc:creator>loren</dc:creator>
		<pubDate>Mon, 16 Jan 2006 12:31:18 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-17</guid>
		<description>Is the doc for dir not clear perhaps?  You can get this structure of output by using dir directly also:

   fstr = dir('*.gif')
in the &lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dir.html"&gt;help description&lt;/a&gt; it says:

&lt;blockquote&gt;
&lt;kbd&gt;files = dir('directory')&lt;/kbd&gt;  returns the list of files in the specified directory (or the current directory, if dirname is not specified) to an m-by-1 structure with the fields: &lt;kbd&gt;name, date, bytes, isdir&lt;/kbd&gt;.
&lt;/blockquote&gt;
</description>
		<content:encoded><![CDATA[<p>Is the doc for dir not clear perhaps?  You can get this structure of output by using dir directly also:</p>
<p>   fstr = dir(&#8217;*.gif&#8217;)<br />
in the <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dir.html">help description</a> it says:</p>
<blockquote><p>
<kbd>files = dir('directory')</kbd>  returns the list of files in the specified directory (or the current directory, if dirname is not specified) to an m-by-1 structure with the fields: <kbd>name, date, bytes, isdir</kbd>.
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yang</title>
		<link>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-16</link>
		<dc:creator>Yang</dc:creator>
		<pubDate>Sun, 15 Jan 2006 07:27:44 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/01/11/mental-model-for-feval/#comment-16</guid>
		<description>Yeah, I think the benefit of usage of the "feval" function is to return a structure argument like the ways described in "More on eval".</description>
		<content:encoded><![CDATA[<p>Yeah, I think the benefit of usage of the &#8220;feval&#8221; function is to return a structure argument like the ways described in &#8220;More on eval&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
