Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
without matlab for loop

Subject: without matlab for loop

From: Ben

Date: 5 Dec, 2010 19:55:04

Message: 1 of 1

Hi all,

Could I implement the following code segment without using for loop?

Q = 0;
for n = 1:N
tmp = 0;
parfor m = 1:M
d = [d1(m,n); d2(m,n)];
dm = d' / sigma2(:,:,m) * d; % Mahalanobis distance
Pmn(m,n) = exp(-0.5*dm) / sqrt(det(sigma2(:,:,m)) + eps;
end;
tmp = sum(Pmn(:,n), 'double') + c;
Pmn(:,n) = Pmn(:,n) / tmp;
Q = Q - log(tmp);
end;

Thank you,
Ben

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us