MATLAB Answers

Error while using cellfun with a function

조회 수: 5(최근 30일)
Arkaniva Sarkar
Arkaniva Sarkar 2021년 5월 13일
댓글: Star Strider 2021년 5월 14일 17:58
I am using cellfun to apply a function on train and test variables for feature extraction. The function works absolutely fine when used without cellfun but with cellfun it gives an error. The code which I'm running:
RRTrain1 = cellfun(@(x)[rrvec] == RRfeatures(x),XTrain,'UniformOutput',false);
And this is the error which is appearing,
Unrecognized function or variable 'rrvec'.
Error in @(x)[rrvec]==RRfeatures(x)
However, rrvec is already declared within RRfeatures function. Can anyone please suggest how to solve this issue?

채택된 답변

Star Strider
Star Strider 2021년 5월 13일
Try this instead —
RRTrain1 = cellfun(@(x)RRfeatures(x),XTrain,'UniformOutput',false);
I have no idea if that will do what you want.
More importantly, if the function works fine on its own, is there a specific reason for using cellfun?
  댓글 수: 4
Star Strider
Star Strider 2021년 5월 14일 17:58
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by