Invalid data type. First argument must be numeric or logical error when using simplisma

1 vue (au cours des 30 derniers jours)
Hi all,
I am getting an error when using the function simplisma(datar,varlisst,1,2). Where datar is a 2x261 table when an FTIR spectra of wavenumber versus intensity and varlisst is a 2x1 table having two different group names of wavenumber and intensity
I am getting an error message reading.
Error using sum
Invalid data type. First argument must be numeric or
logical.
Error in var (line 164)
y = sum(abs(x - sum(x,dim)./n).^2, dim) ./ denom;
Error in std (line 59)
y = sqrt(var(varargin{:}));
Error in simplisma (line 40)
stddata=std(data)*sqrt(nspec-1)/sqrt(nspec);
The code i've been using is:
datar=cell2table(QUVA002)
varlisst=cell2table(varlizt)
simplisma(datar,varlisst,1,2)
This is done for MCR analysis.
Thanks

Réponses (1)

Cris LaPierre
Cris LaPierre le 24 Déc 2021
It looks to me like the issue is one of data type. You create datar and varlisst as tables, which are a MATLAB data type that is sort of a container of variables. Each column in a table is a different variable, and each variable can be a different data type.
A table is neither numeric nor logical.
Perhaps you need to pass in a specific variable in your table as an array. See the Access Data in Tables page for how to do this.
As an example, if your table is datar and the variable you want to pass to simplisma is var1, either of the following would work
datar.var1
datar{:,'var1'}

Catégories

En savoir plus sur Bioinformatics Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by