<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MATLAB pour les geeks &#187; pragma</title>
	<atom:link href="https://blog.developpez.com/matlab4geek/?feed=rss2&#038;tag=pragma" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/matlab4geek</link>
	<description>&#62;&#62;why(393) </description>
	<lastBuildDate>Fri, 09 Jan 2015 13:05:12 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>evalc</title>
		<link>https://blog.developpez.com/matlab4geek/?p=759</link>
		<comments>https://blog.developpez.com/matlab4geek/?p=759#comments</comments>
		<pubDate>Fri, 15 Feb 2013 15:33:55 +0000</pubDate>
		<dc:creator><![CDATA[tug83]]></dc:creator>
				<category><![CDATA[Best-of des commandes MATLAB utiles]]></category>
		<category><![CDATA[evalc]]></category>
		<category><![CDATA[MATLAB Compiler]]></category>
		<category><![CDATA[pragma]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/matlab4geek/?p=759</guid>
		<description><![CDATA[On a vu dans l&#8217;article précédent qu&#8217;evalc est utile pour enlever le verbose : disp, fprintf &#8230; Maintenant si on veut compiler son code qui utilise evalc avec le MATLAB Compiler , il est nécéssaire de rajouter le pragma %#function Comme expliqué dans la doc %#function The %#function pragma informs MATLAB Compiler that the specified [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>On a vu dans l&rsquo;article précédent qu&rsquo;evalc est utile pour enlever le verbose : disp, fprintf &#8230;<br />
Maintenant si on veut compiler son code qui utilise evalc avec le MATLAB Compiler , il est nécéssaire de rajouter le pragma <strong>%#function</strong> <span id="more-759"></span></p>
<p>Comme expliqué dans la doc  <a href="http://www.mathworks.fr/fr/help/compiler/function.html" target="_blank">%#function</a></p>
<blockquote><p>The %#function pragma informs MATLAB Compiler that the specified function(s) will be called through an feval, eval, or Handle Graphics callback.</p></blockquote>
<p>Ok <strong>evalc n&rsquo;est pas cité mais pourtant il faut le faire</strong>!</p>
<p>Si on veut compiler ma fonction bidon matlab4geek (du billet précédent) par exemple , on pourrait ecrire une fonction parent :</p>
<div class="codecolorer-container matlab default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="matlab codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000FF;">function</span> <span style="color: #080;">&#91;</span>blablabla,y<span style="color: #080;">&#93;</span> &nbsp;=test<br />
<br />
<span style="color: #080;">&#91;</span>blablabla,y<span style="color: #080;">&#93;</span> = <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/evalc.html"><span style="color: #0000FF;">evalc</span></a><span style="color: #080;">&#40;</span><span style="color:#A020F0;">'matlab4geek(2)'</span><span style="color: #080;">&#41;</span>;</div></div>
<p>puis la compiler</p>
<div class="codecolorer-container matlab default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="matlab codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mcc -mv test</div></div>
<p>en essayant de l&rsquo;executer:</p>
<div class="codecolorer-container matlab default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="matlab codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">!test</div></div>
<p>on va avoir le message d&rsquo;erreur :</p>
<blockquote><p>Error using evalc<br />
Undefined function &lsquo;matlab4geek&rsquo; for input arguments of type &lsquo;double&rsquo;. </p>
<p>Error in test (line 3) </p></blockquote>
<p>Donc en effet le MATLAB Compiler n&rsquo;a pas compris lors de la compilation que la chaine de caractère matlab4geek était une fonction à embarquer.</p>
<p>La solution est donc :<br />
<!--more--></p>
<p>de rajouter sous le nom de la fonction <strong>%#function matlab4geek</strong></p>
<div class="codecolorer-container matlab default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="matlab codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000FF;">function</span> <span style="color: #080;">&#91;</span>blablabla,y<span style="color: #080;">&#93;</span> &nbsp;=test<br />
<span style="color: #228B22;">%#function matlab4geek</span><br />
<span style="color: #080;">&#91;</span>blablabla,y<span style="color: #080;">&#93;</span> = <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/evalc.html"><span style="color: #0000FF;">evalc</span></a><span style="color: #080;">&#40;</span><span style="color:#A020F0;">'matlab4geek(2)'</span><span style="color: #080;">&#41;</span>;</div></div>
<p>Sur ce bon week-end à tous les Matlab geek!</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
