<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334</link>
    <title>MATLAB Central Newsreader - Call another function!</title>
    <description>Feed for thread: Call another function!</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 15 May 2008 17:37:02 -0400</pubDate>
      <title>Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432302</link>
      <author>Erik Andersson</author>
      <description>I've got the following function:&lt;br&gt;
&lt;br&gt;
function taborttrend&lt;br&gt;
x=load('data.txt');&lt;br&gt;
V=diff(x,1);&lt;br&gt;
&lt;br&gt;
Now a want to call another function lying in the same &lt;br&gt;
directory as taborttrend.m named trend.m which has input x, &lt;br&gt;
i.e trend(x). Now a want my differenced vektor V to be that &lt;br&gt;
input x and that its done in the m-file taborttrend. How do &lt;br&gt;
a get that?&lt;br&gt;
&lt;br&gt;
Thanks for answers!&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 15 May 2008 17:51:02 -0400</pubDate>
      <title>Re: Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432311</link>
      <author>helper </author>
      <description>"Erik Andersson" &amp;lt;annerk02@student.umu.se&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g0hsbt$bvj$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I've got the following function:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function taborttrend&lt;br&gt;
&amp;gt; x=load('data.txt');&lt;br&gt;
&amp;gt; V=diff(x,1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now a want to call another function lying in the same &lt;br&gt;
&amp;gt; directory as taborttrend.m named trend.m which has input &lt;br&gt;
x, &lt;br&gt;
&amp;gt; i.e trend(x). Now a want my differenced vektor V to be &lt;br&gt;
that &lt;br&gt;
&amp;gt; input x and that its done in the m-file taborttrend. How &lt;br&gt;
do &lt;br&gt;
&amp;gt; a get that?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for answers!&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
If I understand your question right, you want to use:&lt;br&gt;
&lt;br&gt;
function taborttrend&lt;br&gt;
x=load('data.txt');&lt;br&gt;
V=diff(x,1);&lt;br&gt;
trend(V)&lt;br&gt;
&lt;br&gt;
Note that when you call a specific function (as you are &lt;br&gt;
doing with TREND), it doesn't matter what the name of the &lt;br&gt;
input variable is within that function.  You can pass any &lt;br&gt;
variable you want.&lt;br&gt;
&lt;br&gt;
If you defined TREND to be:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;function trend(x)&lt;br&gt;
&lt;br&gt;
You don't have to call TREND using "x", however, within &lt;br&gt;
TREND, you must use "x" to reference the passed-in value.&lt;br&gt;
&lt;br&gt;
I hope this addresses and answers your question.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 15 May 2008 17:56:01 -0400</pubDate>
      <title>Re: Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432316</link>
      <author>Erik Andersson</author>
      <description>"Erik Andersson" &amp;lt;annerk02@student.umu.se&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g0hsbt$bvj$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I've got the following function:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function taborttrend&lt;br&gt;
&amp;gt; x=load('data.txt');&lt;br&gt;
&amp;gt; V=diff(x,1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now a want to call another function lying in the same &lt;br&gt;
&amp;gt; directory as taborttrend.m named trend.m which has input &lt;br&gt;
x, &lt;br&gt;
&amp;gt; i.e trend(x). Now a want my differenced vektor V to be &lt;br&gt;
that &lt;br&gt;
&amp;gt; input x and that its done in the m-file taborttrend. How &lt;br&gt;
do &lt;br&gt;
&amp;gt; a get that?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for answers!&lt;br&gt;
&lt;br&gt;
I've tried:&lt;br&gt;
&lt;br&gt;
function taborttrend&lt;br&gt;
&amp;nbsp;x=load('data.txt');&lt;br&gt;
&amp;nbsp;V=diff(x,1);&lt;br&gt;
&amp;nbsp;trend(V)&lt;br&gt;
&lt;br&gt;
But it doesn't work. Why?&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 15 May 2008 19:49:03 -0400</pubDate>
      <title>Re: Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432341</link>
      <author>someone </author>
      <description>"Erik Andersson" &amp;lt;annerk02@student.umu.se&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g0htfh$imr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Erik Andersson" &amp;lt;annerk02@student.umu.se&amp;gt; wrote in &lt;br&gt;
message &lt;br&gt;
&amp;gt; &amp;lt;g0hsbt$bvj$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I've got the following function:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; function taborttrend&lt;br&gt;
&amp;gt; &amp;gt; x=load('data.txt');&lt;br&gt;
&amp;gt; &amp;gt; V=diff(x,1);&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Now a want to call another function lying in the same &lt;br&gt;
&amp;gt; &amp;gt; directory as taborttrend.m named trend.m which has &lt;br&gt;
input &lt;br&gt;
&amp;gt; x, &lt;br&gt;
&amp;gt; &amp;gt; i.e trend(x). Now a want my differenced vektor V to be &lt;br&gt;
&amp;gt; that &lt;br&gt;
&amp;gt; &amp;gt; input x and that its done in the m-file taborttrend. &lt;br&gt;
How &lt;br&gt;
&amp;gt; do &lt;br&gt;
&amp;gt; &amp;gt; a get that?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks for answers!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've tried:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function taborttrend&lt;br&gt;
&amp;gt;  x=load('data.txt');&lt;br&gt;
&amp;gt;  V=diff(x,1);&lt;br&gt;
&amp;gt;  trend(V)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But it doesn't work. Why?&lt;br&gt;
&lt;br&gt;
This is like saying, "I tried to walk, but I fell.  Why?"&lt;br&gt;
There could be MANY reasons.&lt;br&gt;
&lt;br&gt;
How do you know it didn't work?&lt;br&gt;
&lt;br&gt;
What error message did you get?&lt;br&gt;
&lt;br&gt;
What is the code in function trend?&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 15 May 2008 20:10:20 -0400</pubDate>
      <title>Re: Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432349</link>
      <author>helper </author>
      <description>&amp;gt; I've tried:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function taborttrend&lt;br&gt;
&amp;gt;  x=load('data.txt');&lt;br&gt;
&amp;gt;  V=diff(x,1);&lt;br&gt;
&amp;gt;  trend(V)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But it doesn't work. Why?&lt;br&gt;
&lt;br&gt;
I think your flux capacitor overloaded the triple value of &lt;br&gt;
the third exigency.  You might want to uplink with the &lt;br&gt;
fluid portion of the apogee.&lt;br&gt;
&lt;br&gt;
Or....post your error message.  Whichever is easier.&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Fri, 16 May 2008 12:22:01 -0400</pubDate>
      <title>Re: Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432477</link>
      <author>Erik Andersson</author>
      <description>&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I think your flux capacitor overloaded the triple value &lt;br&gt;
of &lt;br&gt;
&amp;gt; the third exigency.  You might want to uplink with the &lt;br&gt;
&amp;gt; fluid portion of the apogee.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Or....post your error message.  Whichever is easier.&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
This is what i get:&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; load&lt;br&gt;
Argument must contain a string.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; trend at 3&lt;br&gt;
V=load(x);&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; taborttrend at 4&lt;br&gt;
trend(x) &lt;br&gt;
&lt;br&gt;
x in this case I want to be my vector V created in the &lt;br&gt;
function taborttrend&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Fri, 16 May 2008 13:29:27 -0400</pubDate>
      <title>Re: Call another function!</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169334#432491</link>
      <author>Peter Boettcher</author>
      <description>"Erik Andersson" &amp;lt;annerk02@student.umu.se&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; I think your flux capacitor overloaded the triple value &lt;br&gt;
&amp;gt; of &lt;br&gt;
&amp;gt;&amp;gt; the third exigency.  You might want to uplink with the &lt;br&gt;
&amp;gt;&amp;gt; fluid portion of the apogee.&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; Or....post your error message.  Whichever is easier.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is what i get:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; load&lt;br&gt;
&amp;gt; Argument must contain a string.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; trend at 3&lt;br&gt;
&amp;gt; V=load(x);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; taborttrend at 4&lt;br&gt;
&amp;gt; trend(x) &lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; x in this case I want to be my vector V created in the &lt;br&gt;
&amp;gt; function taborttrend&lt;br&gt;
&lt;br&gt;
If you load your data in the outer function (taborttrend), then you do&lt;br&gt;
not need to load the data inside your trend function.  I would think you&lt;br&gt;
want your trend function to take as an input the data itself.  That&lt;br&gt;
means, define the function as:&lt;br&gt;
&lt;br&gt;
function &amp;lt;whatever your output variable is&amp;gt; = trend(V)&lt;br&gt;
&lt;br&gt;
and eliminate the V=load(x) line.&lt;br&gt;
&lt;br&gt;
Your taborttrend function has already done the V=load(x), so you can&lt;br&gt;
then simply pass V to the "trend" function, like you are currently doing.&lt;br&gt;
&lt;br&gt;
-Peter&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
