Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Parfor error - Error in ==> parallel_function>make_general_channel/channel_general at 894 Index exceeds matrix dimensions.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have the following code:
classes = {'1_NATURE';'2_SECONDARY_CLASS';'3_TERTIARY_CLASS'}
windows = {'None';'k3';'k5';'k7';'k9';'k11';'k13';'k15';'k17';'k19'};
str1 = 'D:\STUDY\A_IIT_MS_Project\MATLAB_RESULTS\SEQUENCE_PPT\ALL_AGAIN\';
str2 = '\Results\PPT'; str3 = '\Results\Response'; str4 = 'MLR_4_';
matlabpool open 4
parfor class = 1:size(classes,1)
addpath(strcat(str1,classes{class,1}));
for window = 1:size(windows,1)
str_windows = strcat(windows{window,1},'_*');
cd (strcat(str1,classes{class,1},str2));
pre_list = struct([]); file_list = cell(zeros);
pre_list = dir(str_windows); file_list = {pre_list.name}';
cd (strcat(str1,classes{class,1},str3));
pre_list1 = struct([]); file_list1 = cell(zeros);
pre_list1 = dir('Response_*'); file_list1 = {pre_list1.name}';
for list = 3:size(file_list,1)
input4 = file_list{list,1};
in_resp4 = file_list1{list,1};
concat = strcat(str4,input4);
after_concat = regexprep(concat,('.mat'),'');
output4 = after_concat;
cd (strcat(str1,classes{class,1},str2));
Seq_num_prop_calc = cell(zeros);
Seq_num_prop_calc = load(input4);
cd (strcat(str1,classes{class,1},str3));
variables = cell(zeros);
variables = load(in_resp4);
% Multiple Linear Regression
pre_y = 0; pre_x = 0;
pre_y = cell2mat(variables(2:size(variables,1),1:7));
pre_x = cell2mat(Seq_num_prop_calc(2:size(Seq_num_prop_calc,1),5:53));
max_ppt = cell(zeros); count = 1;
%
for god = 1:size(pre_y,2) % 7 Kf-Ku responses
r_value = cell(zeros); a = 1; x1 = 0; x2 = 0;
y = pre_y(:,god);
for i = 1:size(pre_x,2)
for j = i+1:size(pre_x,2)
for k = j+1:size(pre_x,2)
for l = k+1:size(pre_x,2)
x1 = pre_x(:,i);
x2= pre_x(:,j);
x3 = pre_x(:,k);
x4 = pre_x(:,l);
x = [x1,x2,x3,x4];
x_1 = [x,ones(size(x(:,1)))];
[b, bint, r, rint, stats] = regress(y,x_1);
y_new = b(1)*x1 + b(2)*x2 + b(3)*x3 +b(4)*x4 + b(5);
r_check = corr(y_new,y);
god_response = variables{1,god}; ppt1 = Seq_num_prop_calc{1,i+4}; ppt2 = Seq_num_prop_calc{1,j+4};
ppt3 = Seq_num_prop_calc{1,k+4}; ppt4 = Seq_num_prop_calc{1,l+4};
o = (',');
s = strcat(god_response,o,ppt1,o,ppt2,o,ppt3,o,ppt4);
r_value(a,1) = {s};
r_value(a,2) = {b};
r_value(a,3) = {r_check};
r_value(a,4) = {stats};
a = a+1;
end
end
end
end
un_score = '_';
class_name = strcat(output4,un_score,god_response);
file_name = output4;
r_value_mat = cell2mat(r_value(:,3));
max_id = find(r_value_mat == max(r_value_mat));
if size(max_id,1) == 1
max_ppt(count,1) = {class_name};
max_ppt(count+1,2:5) = r_value(max_id,1:4);
count = size(max_ppt,1) + 1;
elseif size(max_id,1) > 1
max_ppt(count,1) = {class_name};
max_ppt(count+1:size(max_id,1),2:5) = r_value(max_id,1:4);
count = size(max_ppt,1) + 1;
end
end
cd (strcat(str1,'MLR\MLR_Results\MLR_4'));
savefunc (file_name, max_ppt, version)
end
end
end
matlabpool close
I am getting the following error:
??? Error using ==> parallel_function at 598 Error in ==> parallel_function>make_general_channel/channel_general at 894 Index exceeds matrix dimensions.
Error in ==> MLR_4 at 13 parfor class = 1:size(classes,1)
2 comentarios
Walter Roberson
el 14 de Ag. de 2013
Have you tried using a regular "for" and seeing if it works that way?
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!