Invalid data type. First argument must be numeric or logical error when using simplisma
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Cris LaPierre
2021-12-24
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'}
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bioinformatics Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!