在Matlab基本健全的错误 [英] Basic sound error in Matlab

查看:223
本文介绍了在Matlab基本健全的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Matlab的函数来产生声音:

I have the following Matlab function to produce a sound:

function [] = makesound( )

    cf = 2000;                  % carrier frequency (Hz)
    sf = 22050;                 % sample frequency (Hz)
    d = 1.0;                    % duration (s)
    n = sf * d;                 % number of samples
    s = (1:n) / sf;             % sound data preparation
    s = sin(2 * pi * cf * s);   % sinusoidal modulation
    sound(s, sf);               % sound presentation
    pause(d + 0.5);             % waiting for sound end

end

然而,当我运行code,我得到以下错误:

However when I run the code, I get the following error:

??? Error using ==> sound
Too many input arguments.

Error in ==> makesound at 14
sound(Beep,rate);

什么是错的?

推荐答案

您可能已经在你的路径的一些功能,名隐藏'Matlab的功能。这个函数的输入参数,然后Matlab的数量较少,因此有太多的输入参数
在我的情况的是断言引起的问题,在你的区分它可以是任何东西。走一步一步的调试器(用F11跳进你前进的道路上有所有功能),直到你找到在哪里一些功能失败的地方。然后确定哪里有问题的功能坐镇的路径,在Matlab的路径列表的底部,所以默认调用的是Matlab的功能的。

You probably have some function in your path, 'name hiding' a Matlab function. This function takes a smaller number of input arguments then Matlab's, therefore the Too many input arguments. In my case it was assert that caused the problem, in your case it could be anything. Walk step-by-step with the debugger (using F11 to jump into all functions you have along the way) till you find the place where some function fails. Then make sure the path where the problematic function sits, is at the bottom of Matlab's path list, so the default call is made to Matlab's function.

这篇关于在Matlab基本健全的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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