Matlab index in range yet I get out of range
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to extract the model parameters using:
clc
clear all
data = xlsread('cancer_train.xlsx');
X = data(:,1:9);
Y = data(:,10);
mdl = fitcnb(X,Y);
mu=[];
[m,n] = size(data);
for i = 1:m
mu(i,1) = mdl.DistributionParameters{1,i}(1);
end
I get index out of range after element 9! The excel can be found here: http://dropcanvas.com/#S47z19vg5WISRQ
댓글 수: 0
답변 (1개)
KSSV
2016년 11월 11일
According to the code, what you pick, the loop should run till 9 only.
clc; clear all ;
clc
clear all
data = xlsread('cancer_train.xlsx');
X = data(:,1:9);
Y = data(:,10);
mdl = fitcnb(X,Y);
% [m,n] = size(data);
m = size(mdl.DistributionParameters,2) ;
mu = zeros(m,1) ;
for i = 1:m
mu(i,1) = mdl.DistributionParameters{1,i}(1);
end
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!