for loop stops when I plot

1 visualizzazione (ultimi 30 giorni)
WonJun Choi
WonJun Choi il 10 Giu 2021
Commentato: WonJun Choi il 10 Giu 2021
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 Commenti
KSSV
KSSV il 10 Giu 2021
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
WonJun Choi il 10 Giu 2021
I got my error thx

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by