代码之家  ›  专栏  ›  技术社区  ›  user1993

在MATLAB中创建火山图时出错

  •  2
  • user1993  · 技术社区  · 7 年前

    the documentation 了解并开始。

    我试着在虚拟值上运行它-

    a=[1 2 3]
    b=[4.6 2.7 4.5]
    c=[0.05 0.33 0.45]
    

    然后我跑了-

    SigStructure = mavolcanoplot(a, b, c)
    

    a b c 是中3个数据点的p值列表 b

    Index exceeds matrix dimensions.
    
    Error in mavolcanoplot (line 127)
    appdata.effect = X(paramStruct.goodVals) - Y(paramStruct.goodVals);
    
    Error in volc (line 4)
    SigStructure = mavolcanoplot(a, b, c)
    

    谁能解释一下我哪里出错了?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Wolfie Radu Stefan    7 年前

    您遇到了一个问题,因为您使用的是行向量。

    mavolcanoplot 函数(您可以通过键入 edit mavolcanoplot 在命令窗口中)有一个用于检查输入的本地函数,称为 check_inputdata

    您的数据通过了所有验证检查,然后遇到以下部分:

    % Here, 'X' and 'Y' are the local names for your inputs 'a' and 'b'
    % Below code is directly from mavolcanoplot.m:
    
    % Handle the matrix input. Use its mean values per row
    if size(X, 2) > 1
        X = mean(X,2);
    end    
    if size(Y, 2) > 1
        Y = mean(Y,2);
    end
    

    这会将您的输入减少到平均值。稍后在主函数(第127行)中,您会遇到所述错误,其中 paramStruct.goodVals


    这基本上是调试和阅读文档的一节课,其中说明

    每行是一个基因 计算每个基因的平均表达值

    您应该使用这些等效方法之一来

    a=[1 2 3].';       % Using transpose (.') to create a column vector from a row vector
    b=[4.6; 2.7; 4.5]; % Creating a column vector using the semi-colon operator to end each row
    c=[0.05
       0.33
       0.45];          % Using actual code layout to create a column vector