Undefined function 'sum' for input arguments of type 'cell'.
이전 댓글 표시
Undefined function 'sum' for input arguments of type 'cell'.
Error in mean (line 116)
y = sum(x, dim, flag)/size(x,dim);
Error in ccaFuse (line 69)
meanX = mean(trainX);
Error in CCA_feature_fusion (line 19)
[trainZ,testZ] = ccaFuse(trainX, trainY, testX, testY, 'concat');
%% program
clc;
clear all;
load('db4.mat');
load('db6.mat');
load('db3.mat');
load('db5.mat');
trainX =reduced_traindata;
trainY = reduced_traindata;
testX = reduced_testdata;
testY = reduced_testdata;
[trainZ,testZ] = ccaFuse(trainX, trainY, testX, testY, 'concat');
댓글 수: 3
dpb
2020년 2월 29일
Didn't show us the pertinent code where the error actually is, but the message is clear. Apparently your variable trainX is a cell; and mean can't take the mean of the cell but has to have the content of the cell. Dereference the cell with "the curlies" {}.
W/o downloading the files don't know what is actually in the cell, but if is just a double vector, use
meanX = mean(trainX{:});
or, instead convert the cells to double in the calling code first:
trainX=cell2mat(reduced_traindata);
trainY=cell2mat(reduced_traindata);
testX=cell2mat(reduced_testdata);
testY=cell2mat(reduced_testdata);
before calling ccaFuse
Balaji M. Sontakke
2020년 3월 1일
Balaji M. Sontakke
2020년 3월 1일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!