【问题标题】:Matlab error while creating a matrix创建矩阵时的Matlab错误
【发布时间】:2013-01-09 03:46:44
【问题描述】:

我想在矩阵中插入 'double' 类型的值。为此,我正在使用以下 Matlab 代码行创建一个矩阵:

dpitchcnt=(N/256); %N is total number of byte
pitchvec(1:int64(dpitchcnt)); %creating a matrix 'pitchvec' with 1 row and int64(dpitchcnt)' columns   
size(pitchvec) %Trying to display the size.

执行上述操作时出现以下错误:

类型输入参数的未定义函数或方法“_colonobj” 'int64'。 ==> 在 31 pitchevec(1:int64(dpitchcnt)) 处的样本出错;

我做错了什么?

【问题讨论】:

    标签: matlab matrix


    【解决方案1】:

    语法varName(1:10)会得到varName的前10个值,而不是创建变量varName

    要创建矩阵,您可以使用

    pitchvec = zeros(1,int64(dpitchcnt)); %A zero-matrix
    matrixSize = size(pitchvec);
    

    你也可以使用ones(n,m);%Create a n times m matrix with 1 all over.

    【讨论】:

      猜你喜欢
      • 2015-10-12
      • 1970-01-01
      • 1970-01-01
      • 2012-03-16
      • 1970-01-01
      • 2014-04-17
      • 1970-01-01
      • 1970-01-01
      • 2014-07-27
      相关资源
      最近更新 更多