for loop stops when I plot
이전 댓글 표시
Hi,
I'm trying to plot clustered neuron spikes from 'spikes.mat' data. I used k-means clustering and pca function.
I already have 3 big infuence data index, data clustered index.
But each time I start debug, it stops. My for loop doesn't do 1:size(idx).
My size(idx) is 80397x1 double.
Does anyone know what the problem my code has?
%Spike Sorting
load('spikes.mat'); %detected spikes
[coeff,score,latent,tsquared,explained,mu] = pca(spikes); %PCA analysis
nscore(:,1) = score(:,1);
nscore(:,2) = score(:,2); %score data 정규화
[idx,C] = kmeans(nscore,2); %idx는 군집 인덱스
%Sidx = [nscore, idx];
for k=1:size(idx)
if(idx(k)==1)
figure(1)
title('cluster1 spikes')
plot(nscore(k))
hold on
end
end
for k=1:size(idx)
if(idx(k)==2)
figure(2)
title('cluster2 spikes')
plot(nscore(k))
hold on
end
end
댓글 수: 2
KSSV
2021년 6월 10일
If you do debug, it will stop. You need to quit debug; did you quit debug to proceed to next loop index?
Also
plot(nscore(k))
dont seem to be right.
WonJun Choi
2021년 6월 10일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Pattern Recognition에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!