【问题标题】:Matlab Will Not Add PathMatlab不会添加路径
【发布时间】:2014-03-12 17:15:29
【问题描述】:

我试图从命令窗口调用一个函数,但我经常被消息阻碍

Undefined function 'gDiscrPdfRnd' for
input arguments of type 'double'.

所以,我在谷歌搜索了这条消息。根据这篇帖子here,可能的原因是matlab找不到文件。我找到了这个page,它讲述了如何添加路径。所以,我输入了命令

addpath('C:\Users\Eli\Documents\MATLAB\final project\help')

然后我输入了

which gDiscrPdfRnd

这给了我找不到错误“gDiscrPdfRnd”。我该如何解决这个问题?

编辑: cd('C:\Users\Eli\Documents\MATLAB\final project\help');dir 的输出是

.                       IdealGasSimulation.zip  randpdf                 
..                      gDiscrPdfRnd funct      randpdf.zip             
IdealGasSimulation      gDiscrPdfRnd funct.zip  

【问题讨论】:

  • 你确定,'gDiscrPdfRnd.m' 在 'C:\Users\Eli\Documents\MATLAB\final project\help' 中?
  • cd('C:\Users\Eli\Documents\MATLAB\final project\help');dir 的输出是什么?
  • @Divakar 是的,我确定。
  • @Daniel 我刚刚编辑了我的帖子。

标签: matlab function path path-finding


【解决方案1】:

文件夹中没有文件gDiscrPdfRnd.m,放入help目录或添加gDiscrPdfRnd.m所在的文件夹。

【讨论】:

  • 好的,我能够让它工作。但是,知道我在使用内置 matlab 函数时收到了相同的错误消息。例如,当我使用 datasample 时,我收到消息 Undefined function 'datasample' for input arguments of 'double' 类型。然后我输入“哪个数据样本”,它说“找不到数据样本”。为什么会这样?会不会和matlab的新更新有关系?
  • datasample 是统计工具箱的一部分。是否已安装并获得许可?
  • ...我没有。为了使用它,是否只有为工具箱付费?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-06
  • 1970-01-01
  • 1970-01-01
  • 2013-03-12
  • 1970-01-01
相关资源
最近更新 更多