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

32 views (last 30 days)
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
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)
The code i've been using is:
This is done for MCR analysis.

Answers (1)

Cris LaPierre
Cris LaPierre on 24 Dec 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

Community Treasure Hunt

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

Start Hunting!