vectorize for loop while a matrix should be splited inside the loop

조회 수: 1 (최근 30일)
Sadegh Salesi Mousaabadi
Sadegh Salesi Mousaabadi 2017년 3월 3일
답변: Walter Roberson 2017년 3월 6일
Hi guys, I want to vectorize this for loop but not much progress unfortunately. I appreciate your helps in advance.
for j = 1 :j
MIxy(j)=kernel(X(j,:),y);
end
where kernel is a function which receives two vectors and calculates their kernel value. the X is an n by m matrix. I wanna calculate the kernel of each row of the matrix X with matrix y can save it in MIxy.
Many thanks
  댓글 수: 2
Darshan Ramakant Bhat
Darshan Ramakant Bhat 2017년 3월 6일
How are you calculating the kernel of two vectors. You can apply vectorization if kernel function can directly handle the matrices. Please specify your kernel() function.
Regards
Darshan Bhat
KSSV
KSSV 2017년 3월 6일
You will not get help unless kernel function known to us.

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

답변 (1개)

Walter Roberson
Walter Roberson 2017년 3월 6일
for j = 1 :j
MIxy(j, :)=kernel(X(j,:),y);
end

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by