dimanche 26 novembre 2017

MATLAB: Last row in a matrix is not computing :(

So i have a homogenous numeric array as shown below. I converted this array to a table using the array2Table function. What is shown below is simply the variabe names being applied to the array. I have column names but I would like to have row names as well. Is it the fact that the array is of one variable class that I cant do this?

T = array2table(C,'RowNames',{'','T0','T1','T2','T3','T4'},'VariableNames' ,{'to','t1','t2','t3','t4','t5','t6','t7','t8','t9','t10'})




T =

  6×11 table

    to       t1        t2        t3        t4        t5        t6        t7        t8        t9       t10  
    ___    ______    ______    ______    ______    ______    ______    ______    ______    ______    ______

      0        18        36        54        72        90       108       126       144       162       180
     15        15        15        15        15        15        15        15        15        15        15
    325    304.17     303.4    295.01    293.52     288.3    286.56    282.49     280.5    276.99     274.8
    325       325    315.67    314.35    308.58    306.86    302.38    300.33    296.49    294.19    290.74
    325       325       325    320.82     319.8    315.43    313.61    309.61    307.35    303.69     301.2
    325       325       325       325    321.25    319.95     315.9    313.85    310.05    307.63     304.1

The errors that Im getting here are:

Error using matlab.internal.tabular.private.rowNamesDim/validateAndAssignLabels (line 109)
The RowNames property must be a cell array, with each element containing one nonempty character vector.

Error in matlab.internal.tabular.private.tabularDimension/setLabels (line 173)
            obj = obj.validateAndAssignLabels(newLabels,indices,fullAssignment,fixDups,fixEmpties,fixIllegal);

Error in matlab.internal.tabular.private.tabularDimension/createLike_impl (line 355)
                obj = obj.setLabels(dimLabels,[]);

Error in matlab.internal.tabular.private.tabularDimension/createLike (line 62)
                obj = obj.createLike_impl(dimLength,dimLabels);

Error in tabular/initInternals (line 206)
            t.rowDim = t.rowDim.createLike(nrows,rowLabels);

Error in table.init (line 327)
            t = initInternals(t, vars, numRows, rowLabels, numVars, varnames);

Error in array2table (line 64)
    t = table.init(vars,nrows,rownames,nvars,varnames);

Aucun commentaire:

Enregistrer un commentaire