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 个评论

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.
I got my error thx

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by