Output argument "K" (and maybe others) not assigned during call to "linear_kernel".

조회 수: 3 (최근 30일)
Hi all,
the above error apears when I call
K = linear_kernel(tX, tX);
It does not appear if I do not assign linear_kernel(tX,tX).
The function I am referring is:
function K = linear_kernel(x1,x2)
%LINEAR_KERNEL Build a linear kernel.
% Ensure that x1 and x2 are column vectors
x1 = x1(:);
x2 = x2(:);
% Compute the kernel
K = x1' * x2; % dot product
end
why does this happen?

채택된 답변

Star Strider
Star Strider 2021년 5월 5일
Why not just —
K = dot(x1,x2)
instead?
See the documentation on the dot function for details.
  댓글 수: 2
federico nutarelli
federico nutarelli 2021년 5월 5일
You are right. I did not know dot that much so I did not feel confident. Anyway issue solved because I changed the working directory

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Adding custom doc에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by