禁止输出MATLAB [英] Suppressing Output MATLAB

查看:111
本文介绍了禁止输出MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码输出给了if,exact_answer,然后是具有N个条目的向量输出.我不确定如何禁止该条目.例如,它看起来如下所示:

My code output gives me if, exact_answer, and then a vector output with N entries. I am unsure how to suppress that entry. For example, it looks like the following:

exact_answer =

    0.2642


If =

    0.1882


ans =

         0    0.1637    0.2681    0.3293    0.3595    0.3679

我不想要答案输出. -

I don't want the answer output. -

function g = LaplaceTransform(s,N)
        % define function parameters
        a=0; 
        b=1;
        h=(b-a)/N;
        x = 0:h:1;
        % define function
        g = ff(x).*exp(-s*x);

% compute the exact answer of the integral
exact_answer=antiderivative(b,s)-antiderivative(a,s)
% compute the composite trapezoid sum
If=0;
for i=1:(N-1)
    If=If+g(i).*h;
end;
If=If+g(1).*h/2+g(N).*h/2;
If

推荐答案

ans出现,因为您打电话

LaplaceTransform(bla, blabla)

代替

LaplaceTransform(bla, blabla);

(您在调用函数时缺少分号).

exact_answer出现是因为您的行

exact_answer=antiderivative(b,s)-antiderivative(a,s)

也缺少分号,您应该有

exact_answer=antiderivative(b,s)-antiderivative(a,s);

这篇关于禁止输出MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆